You are given a sequence a1, a2, ..., an of one-dimensional segments numbered 1 through n. Your task is to find two distinct indices i and j such that segment ai lies within segment aj.

Segment [l1, r1] lies within segment [l2, r2] iff l1 ≥ l2 and r1 ≤ r2.

Print indices i and j. If there are multiple answers, print any of them. If no answer exists, print -1 -1.

Input

The first line contains one integer n (1 ≤ n ≤ 3·105) — the number of segments.

Each of the next n lines contains two integers li and ri (1 ≤ li ≤ ri ≤ 109) — the i-th segment.

Output

Print two distinct indices i and j such that segment ai lies within segment aj. If there are multiple answers, print any of them. If no answer exists, print -1 -1.

Examples

Input

5
1 10
2 9
3 9
2 3
2 9


Output

2 1


Input

3
1 5
2 6
6 20


Output

-1 -1

Note

In the first example the following pairs are considered correct:

  * (2, 1), (3, 1), (4, 1), (5, 1) — not even touching borders; 
  * (3, 2), (4, 2), (3, 5), (4, 5) — touch one border; 
  * (5, 2), (2, 5) — match exactly. 
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;

public class C {
	
	/*
	 * 6
1 1
2 2
3 3
4 4
114214 125125
19360 19365

6
1 1
2 2
3 3
4 4
114214
125125
19395 19360
	 */
	
	
	static range ar[];
	public static void main(String args[]) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);
		
		int N = in.nextInt();
		ar = new range[N];
		for(int i = 0; i < N; i++) {
			ar[i] = new range(in.nextInt(), in.nextInt(), i+1);
		}
		Arrays.sort(ar);
		
		int ys[] = new int[N];
		for(int i = 0; i < N; i++) ys[i] = ar[i].r;
		RMQ rmq = new RMQ(ys);
		
		for(int i = 0; i < N-1; i++) {
			if(ar[i+1].l > ar[i].r) continue;
			int last = bs(i+1, N-1, ar[i].r);
			if(rmq.query(i+1, last) <= ar[i].r) {
				//possible, get answer and return;
				
				for(int j = i+1; j <= last; j++) {
					if(ar[j].r <= ar[i].r) {
						System.out.println(ar[j].id+" "+ar[i].id);
						return;
					}
				}
				
				
			}
			
		}
		System.out.println("-1 -1");
		
		
		out.close();
	}
	
	static int bs(int lo, int hi, int max) {
		if(lo==hi) return lo;
		if(lo+1 == hi) {
			if(ar[hi].l <= max) return hi;
			return lo;
		}
		int mid = (lo+hi)/2;
		if(ar[mid].l <= max) return bs(mid, hi, max);
		return bs(lo, mid, max);
		
	}
	
	
	static class range implements Comparable<range>{
		int l, r, id;
		public range(int a, int b, int c) {
			l=a;
			r=b;
			id = c;
		}
		@Override
		public int compareTo(range o) {
			if(this.l == o.l) return o.r-this.r;
			return this.l-o.l;
		}
	}
	
	
	static class RMQ {
		int[] vs;
		int[][] lift;

		public RMQ(int[] vs) {
			this.vs = vs;
			int n = vs.length;
			int maxlog = Integer.numberOfTrailingZeros(Integer.highestOneBit(n)) + 2;
			lift = new int[maxlog][n];
			for (int i = 0; i < n; i++)
				lift[0][i] = vs[i];
			int lastRange = 1;
			for (int lg = 1; lg < maxlog; lg++) {
				for (int i = 0; i < n; i++) {
					lift[lg][i] = Math.min(lift[lg - 1][i], lift[lg - 1][Math.min(i + lastRange, n - 1)]);
				}
				lastRange *= 2;
			}
		}

		public int query(int low, int hi) {
			int range = hi - low + 1;
			int exp = Integer.highestOneBit(range);
			int lg = Integer.numberOfTrailingZeros(exp);
			return Math.min(lift[lg][low], lift[lg][hi - exp + 1]);
		}
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;
		
		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}
		
		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}
		
		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}				
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}
		
		public int nextInt() {
			return (int)nextLong();
		}
		
		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}
		
		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}
		
		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}
		
		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}
	
}
