Segments on the line return
On a line, there are N distinct segments ([a_i, b_i]) for (i = 1, 2, ..., N), where (a_i < b_i). We say that segment i is directly contained in segment j ((i j)) if:
Segment i is entirely within segment j (i.e., (a_j a_i) and (b_i b_j));
There is no other segment k such that segment i is within segment k and segment k is within segment j (where (i), (j), and (k) are distinct).
Your task is to determine, for each segment, the segment in which it is directly contained, or indicate that there is none. If a segment is directly contained in multiple segments, any one of them is acceptable.
Input
The first line contains an integer N ((1 N 100,000)). The next N lines each contain two integers (a_i) and (b_i) ((-10^9 a_i < b_i 10^9)).
Output
Output N integers. The i-th number should be the index of the segment in which segment i is directly contained, or 0 if there is none.
If there are multiple valid answers, output any one of them.