Endless Road

아직 제출이 없습니다시간 제한5초메모리 제한1024 MB

문제

Whenever students of KAIST go outside of campus, they usually follow a straight road named the Endless Road. The name comes from the fact that most students feel like the road is endless. One factor for this is due to the boring scenery of the road. Here, we model the Endless Road as a straight line of length 10910^9. The position over the straight line can be denoted as a single real number x\[0,109)x \in \[0, 10^9).

To cope with this, the members of RUN@KAIST decided to plant different kinds of colorful flowers on this road. NN members of RUN@KAIST are numbered from 1N1 \ldots N. In the last regular meeting, each member is assigned a nonempty segment over the straight line \[L_i,R_i)\[L\_i, R\_i), containing all positions L_ix<R_iL\_i \le x < R\_i

The member with a higher index bears more responsibility for the tasks on the club. Thus, the length of the segment is nondecreasing as the indices of the members increases. In other words, R_iL_iR_jL_jR\_i - L\_i \leq R\_j - L\_j for 1i<jN1 \le i < j \le N.

The planting is done in NN turns. In each turn, we select one previously unselected member to plant flowers. The selected member plants the flowers in their assigned segment \[L_i,R_i)\[L\_i, R\_i), except where other members have already planted flowers before. 

To make the work distribution more equitable, the selection is done in the following way:

  • Pick the member who will plant the minimum amount of flowers. Here, the amount of flowers are determined by the length of the interval where a member planted new flowers, which could be zero.
  • If there is more than one such member, pick the member with minimum index.

Jaeung should now announce the planting schedule. For this, he has to find an order in which the NN members will plant the flowers, according to the above selection rules.

입력

The first line contains an integer NN.

The next NN lines each contain two integers L_iL\_i and R_iR\_i.

출력

Output NN space-separated integers denoting the order of planting. The ii-th integer denotes the index of member who will plant the flower in the ii-th turn.

제한

  • 1N250,0001 \leq N \leq 250\\,000
  • 0L_i<R_i1090 \le L\_i < R\_i \le 10^9
  • R_iL_iR_jL_jR\_i - L\_i \leq R\_j - L\_j for all 1i<jN1 \le i < j \le N.
  • All intervals are distinct. In other words, (L_i,R_i)(L_j,R_j)(L\_i, R\_i) \neq (L\_j, R\_j) for all 1i<jN1 \le i < j \le N.