Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Big Segment

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputA coordinate line has *n* segments, the *i*-th segment starts at the position *l*_{i} and ends at the position *r*_{i}. We will denote such a segment as [*l*_{i}, *r*_{i}].

You have suggested that one of the defined segments covers all others. In other words, there is such segment in the given set, which contains all other ones. Now you want to test your assumption. Find in the given set the segment which covers all other segments, and print its number. If such a segment doesn't exist, print -1.

Formally we will assume that segment [*a*, *b*] covers segment [*c*, *d*], if they meet this condition *a* ≤ *c* ≤ *d* ≤ *b*.

Input

The first line contains integer *n* (1 ≤ *n* ≤ 10^{5}) — the number of segments. Next *n* lines contain the descriptions of the segments. The *i*-th line contains two space-separated integers *l*_{i}, *r*_{i} (1 ≤ *l*_{i} ≤ *r*_{i} ≤ 10^{9}) — the borders of the *i*-th segment.

It is guaranteed that no two segments coincide.

Output

Print a single integer — the number of the segment that covers all other segments in the set. If there's no solution, print -1.

The segments are numbered starting from 1 in the order in which they appear in the input.

Examples

Input

3

1 1

2 2

3 3

Output

-1

Input

6

1 5

2 3

1 10

7 10

7 7

10 10

Output

3

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jan/19/2020 09:22:09 (g2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|