Limits: 1s, 128 MB

Zico is a fan of Artificial Intelligence(AI). So he is doing a course on AI and even likes the teacher who takes the AI course very much. During class, he always listens to the teacher and responds very fast. Once he thought of an idea to impress the teacher by making a robot. This robot can do a large variety of tasks. But some tasks are required to be done before some tasks while others are needed to be done after some tasks. Zico became confused how to create the algorithm that tells the robot what to do. He is desperate to impress the teacher so he asks your help as he knows you are an expert in algorithms. He has the list of tasks that needs to be done, can you help him?

This is a companion discussion topic for the original entry at https://toph.co/p/tasks