Hide

Problem G
Accelerated Compulsive Meteors

You have just started playing a new space-based role playing game Galaxy War Online. The evil empire has been reigning the universe for too long and a new coalition has been forming to try and knock the empire out of power. You are a commander in the new coalition in charge of the Accelerated Compulsive Meteors Brigade (or ACM for short). As part of your role as commander, you must keep track of your sub-brigades while they are in battle. You must be able to show a snapshot of your brigade to show your superiors the state of the brigade.

Your brigade is structured in a hierarchical way:

  1. At the top of the brigade is you.

  2. You have two lieutenants who are under you

  3. Each lieutenant is in command of two sub-brigade each with one Captain

  4. Each captain is in control of two areas, each with one sub-captain

  5. Each sub-captain has two floats, and each float has two pilots, each pilot has two sub-pilots and so on.

Your brigade is divided into n number of levels. The first level being you and your front line of defense being level n. As seen in the structure above each level, has twice the number of people as the level before it. As the war happens you must update the state of your brigade. As certain people in your brigade get eliminated by the enemy forces, everyone under them will be eliminated with them. You must keep track of your brigade as these eliminations happen and be ready to show it to your bosses.

Input

You are given an integer n ($0 \leq n \leq 10^4$) which corresponds to the number of elements in your brigade. Each element has an id from 0 to n which is unique. As commander, you stand at the top of the hierarchy, so you are number 1. Your two lieutenants are numbers 2 (to your left) and 3 (to your right). Under number 2 are 4 (to its left) and 5 (to its right) and under number 3 are 6 (to its left) and 7 (to its right). This tree-like pattern continues until you reach n elements.

You are then given an integer $x$ ($0 \leq x \leq 101$) which corresponds to the number of commands to execute.

Each of the $x$ lines after that have one of the two commands: Eliminate or Status.

Eliminate commands are followed by an integer corresponding to the id of who is being eliminated. When a commander is eliminated, all of the troops under their command are also eliminated.

Status asks you to print the status of your brigade by printing each member left in your brigade on their own line in increasing order (see test case below).

Output

Print your brigade by levels, starting with you as the first element and continuing down the structure, ignoring those that have been eliminated.

Sample Input 1 Sample Output 1
7
2
Eliminate 2
Status
1
3
6
7
Sample Input 2 Sample Output 2
4
2
Eliminate 2
Status
1
3

Please log in to submit a solution to this problem

Log in