Luba needs your help again! Luba has n TV sets. She knows that i-th TV set will be working from moment of time li till moment ri, inclusive.

Luba wants to switch off one of TV sets in order to free the socket. Let's call some TV set redundant if after switching it off the number of integer moments of time when at least one of TV sets is working won't decrease. Luba will be very upset if she has to switch off a non-redundant TV set.

Help Luba by telling her the index of some redundant TV set. If there is no any, print -1.

Input

The first line contains one integer number n (1 ≤ n ≤ 2·105) — the number of TV sets.

Then n lines follow, each of them containing two integer numbers li, ri (0 ≤ li ≤ ri ≤ 109) denoting the working time of i-th TV set.

Output

If there is no any redundant TV set, print -1. Otherwise print the index of any redundant TV set (TV sets are indexed from 1 to n).

If there are multiple answers, print any of them.

Examples

Input

3
1 3
4 6
1 7


Output

1


Input

2
0 10
0 10


Output

1


Input

3
1 2
3 4
6 8


Output

-1


Input

3
1 2
2 3
3 4


Output

2

Note

Consider the first sample. Initially all integer moments of time such that at least one TV set is working are from the segment [1;7]. It's easy to see that this segment won't change if we switch off the first TV set (or the second one).

Note that in the fourth sample you can switch off the second TV set, since even without it all integer moments such that any of the TV sets is working denote the segment [1;4].
import java.util.*;
import java.io.*;

public class _0863_E_TurnOffTheTV {

	static class Node{
		int l, r, val, lazy;
		public Node(int l, int r) {
			this.l = l; this.r = r;
		}
	}
	
	static Node seg[];
	
	static void build(int l, int r, int idx) {
		seg[idx] = new Node(l, r);
		if(l == r) return;
		int mid = (l + r)/2;
		build(l, mid, 2*idx); build(mid+1, r, 2*idx+1);
	}
	
	static void upd(int l, int r, int idx) {
		if(seg[idx].l == l && seg[idx].r == r) {
			seg[idx].val++; seg[idx].lazy++; return;
		}
		int mid = (seg[idx].l + seg[idx].r)/2;
		pd(idx);
		if(r <= mid) upd(l, r, 2*idx);
		else if(l > mid) upd(l, r, 2*idx+1);
		else {upd(l, mid, 2*idx); upd(mid+1, r, 2*idx+1);}
		seg[idx].val = Math.min(seg[2*idx].val, seg[2*idx+1].val);
	}
	
	static int query(int l, int r, int idx) {
		if(seg[idx].l == l && seg[idx].r == r) return seg[idx].val;
		int mid = (seg[idx].l + seg[idx].r)/2; pd(idx);
		if(r <= mid) return query(l, r, 2*idx);
		else if(l > mid) return query(l,r, 2*idx+1);
		else return Math.min(query(l, mid, 2*idx), query(mid+1, r, 2*idx+1));
	}
	
	static void pd(int idx) {
		seg[2*idx].val += seg[idx].lazy;
		seg[2*idx].lazy += seg[idx].lazy;
		seg[2*idx+1].val += seg[idx].lazy;
		seg[2*idx+1].lazy += seg[idx].lazy;
		seg[idx].lazy = 0;
	}
	
	public static void main(String[] args) throws IOException {
		int N = readInt();
		seg = new Node[16*N+1]; build(1, 4*N, 1);
		HashMap<Integer, Integer> comp = new HashMap<Integer, Integer>();
		int l[] = new int[N+1], r[] = new int[N+1];
		Integer val[] = new Integer[2*N];
//		HashSet<Integer> set = new HashSet<>();
		for(int i = 1; i<=N; i++) {
			l[i] = readInt()-1; r[i] = readInt();
			val[(i-1)*2] = l[i]; val[(i-1)*2+1] = r[i];
//			if(set.contains(l[i]) || set.contains(r[i])) {println(i); exit();}
//			set.add(l[i]); set.add(r[i]);
		}
		Arrays.sort(val);
		for(int i = 0, cnt = 1; i<2*N; i++) 
			if(i == 0 || val[i] != val[i-1]) {
				comp.put(val[i], cnt);
				cnt += 2;
			}
		for(int i = 1; i<=N; i++) {
//			println(comp.get(l[i]) + " " + comp.get(r[i])); flush();
			upd(comp.get(l[i]), comp.get(r[i]), 1);
		}
		for(int i = 1; i<=N; i++) {
			if(query(comp.get(l[i]), comp.get(r[i]), 1) > 1) {println(i); exit();}
		}
		println(-1);
		exit();
	}

	final private static int BUFFER_SIZE = 1 << 16;
	private static DataInputStream din = new DataInputStream(System.in);
	private static byte[] buffer = new byte[BUFFER_SIZE];
	private static int bufferPointer = 0, bytesRead = 0;
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	public static String readLine() throws IOException {
		byte[] buf = new byte[64]; // line length
		int cnt = 0, c;
		while ((c = Read()) != -1) {
			if (c == '\n')
				break;
			buf[cnt++] = (byte) c;
		}
		return new String(buf, 0, cnt);
	}

	public static String read() throws IOException {
		byte[] ret = new byte[1024];
		int idx = 0;
		byte c = Read();
		while (c <= ' ') {
			c = Read();
		}
		do {
			ret[idx++] = c;
			c = Read();
		} while (c != -1 && c != ' ' && c != '\n' && c != '\r');
		return new String(ret, 0, idx);
	}

	public static int readInt() throws IOException {
		int ret = 0;
		byte c = Read();
		while (c <= ' ')
			c = Read();
		boolean neg = (c == '-');
		if (neg)
			c = Read();
		do {
			ret = ret * 10 + c - '0';
		} while ((c = Read()) >= '0' && c <= '9');

		if (neg)
			return -ret;
		return ret;
	}

	public static long readLong() throws IOException {
		long ret = 0;
		byte c = Read();
		while (c <= ' ')
			c = Read();
		boolean neg = (c == '-');
		if (neg)
			c = Read();
		do {
			ret = ret * 10 + c - '0';
		} while ((c = Read()) >= '0' && c <= '9');
		if (neg)
			return -ret;
		return ret;
	}

	public static double readDouble() throws IOException {
		double ret = 0, div = 1;
		byte c = Read();
		while (c <= ' ')
			c = Read();
		boolean neg = (c == '-');
		if (neg)
			c = Read();

		do {
			ret = ret * 10 + c - '0';
		} while ((c = Read()) >= '0' && c <= '9');

		if (c == '.') {
			while ((c = Read()) >= '0' && c <= '9') {
				ret += (c - '0') / (div *= 10);
			}
		}

		if (neg)
			return -ret;
		return ret;
	}

	private static void fillBuffer() throws IOException {
		bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
		if (bytesRead == -1)
			buffer[0] = -1;
	}

	private static byte Read() throws IOException {
		if (bufferPointer == bytesRead)
			fillBuffer();
		return buffer[bufferPointer++];
	}

	static void print(Object o) {
		pr.print(o);
	}

	static void println(Object o) {
		pr.println(o);
	}

	static void flush() {
		pr.flush();
	}

	static void println() {
		pr.println();
	}

	static void exit() throws IOException {
		din.close();
		pr.close();
		System.exit(0);
	}
}
