Bessie and Canmuu are teaming up to wash the massive pile of (1 \le n \le 10000) dirty dishes left over after the CowMoose Festival. Bessie washes the dishes, and Canmuu dries them.
Each dish has a unique serial number in the range 1, 2, \ldots, n. At the beginning, the dishes are stacked in order with on the top and on the bottom.
Bessie first washes some number of dishes D_i by taking them one by one from the top of the incoming pile, washing each dish, and stacking it on the other side of the sink (this reverses the order of those dishes).
Once she has finished washing the current batch, she either washes another set of dishes or Canmuu comes back to dry D_i dishes while Bessie goes off to have her well-earned snack. Canmuu takes the dishes one by one from the stack that Bessie left, dries them, and stacks them (again in reverse order) in the cleaned dish stack.
Then, Canmuu either dries another batch of dishes or goes for a snack while Bessie resumes washing. They repeat these operations until all of the dishes are washed and dried.
What is the final order (from top to bottom) in which the clean, dry dishes are stacked?
For example, suppose Bessie has a stack of dishes to wash:

Suppose D_1 = 3, so Bessie takes three dishes from the top of the stack, one by one, washes them, and stacks them on the other side of the sink for Canmuu to dry:

Canmuu dries two of these, one by one, and places them onto the cleaned stack:

Bessie then washes the remaining two dishes:

Finally, Canmuu dries the last three dishes and stacks them in this order:

So, the final order is: , , , , .
Each command line of input contains the action C_i (1 \le C_i \le 2), where means "Bessie washes" and means "Canmuu dries", and the number D_i (1 \le D_i \le n) — the number of dishes to wash or dry in that operation.
The first line contains , the number of dishes to wash and dry.
Starting from the second line, each line contains two integers: C_i and D_i — the action and the number of dishes to process, respectively.
Print lines: the -th line should contain the number of the -th cleaned dish (counted from the top of the final stack).
Example 1