Segments on the line return#1699

Segments on the line return

2 seconds
64 megabytes
Medium

On a line, there are distinct segments [a_i, b_i] (i = 1, 2, \ldots, N,\ a_i < b_i). A segment is directly contained in segment (i \neq j) if:

For each segment, determine the segment in which it is directly contained, or report that there isn't any. If a segment is directly contained in several segments, any of them is acceptable.

Input

The first line contains an integer (1 \leq N \leq 100\ 000). Then pairs of integers a_i, b_i (-10^9 \leq a_i < b_i \leq 10^9) follow.

Output

Output integers. The -th number should be the index of the segment in which segment is directly contained, or if there is none.

If there are multiple valid answers, print any of them.

Examples

Example 1

Loading
Loading