There will be several test cases in the input. Each test case consists of *N* + 1 lines where *N* (1 ≤ *N* ≤ 200,000) is given in the first line of the test case. The next *N* lines contain the pairs of values *Pos*_{i} and *Val*_{i} in the increasing order of *i* (1 ≤ *i* ≤ *N*). For each *i*, the ranges and meanings of *Pos*_{i} and *Val*_{i} are as follows:

*Pos*∈ [0,_{i}*i*− 1] — The*i*-th person came to the queue and stood right behind the*Pos*-th person in the queue. The booking office was considered the 0th person and the person at the front of the queue was considered the first person in the queue._{i}*Val*∈ [0, 32767] — The_{i}*i*-th person was assigned the value*Val*._{i}

For each test cases, output a single line of space-separated integers which are the values of people in the order they stand in the queue.

提交代码