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. 
// package CF;

import java.awt.Point;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class C {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		Point [] p = new Point[n];
		Integer [] a = new Integer[n];
		for (int i = 0; i < p.length; i++) {
			a[i] = i;
			p[i] = new Point(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(a, new Comparator<Integer>() {

			@Override
			public int compare(Integer o1, Integer o2) {
				// TODO Auto-generated method stub
				return p[o1].x == p[o2].x?p[o2].y - p[o1].y:p[o1].x - p[o2].x;
			}
		});
		int N = 1;
		while(N < n) N <<= 1;
		int [] r = new int[N+1];
		Arrays.fill(r, (int)1e9+10);
		for (int i = 0; i < n; i++) {
			r[i] = p[a[i]].y;
		}
//		System.out.println(Arrays.toString(r));
		SparseTable st = new SparseTable(r);
		boolean found = false;
		for (int i = 0; i < n-1; i++) {
			int lo = i+1, hi = n-1, ans = n-1;
			while(lo <= hi){
				int mid = (lo+hi)/2;
				if(p[a[i]].y >= p[a[mid]].x){
					ans = mid;
					lo = mid+1;
				}
				else hi = mid-1;
			}
//			System.out.println(ans);
			int min = st.query(i+1, ans);
//			System.out.println(min);
			if(p[a[min]].y <= p[a[i]].y){
				found = true;
				out.println(a[min]+1 + " " + (a[i]+1));
				break;
			}
		}
		if(!found)
			out.println("-1 -1");
		out.flush();
		out.close();
	}
	static class SparseTable {                                          
		  
		int A[], SpT[][], ind [][];
		
		SparseTable(int[] A) 
		{
			int n = A.length;	this.A = A;
			int k = (int)Math.floor(Math.log(n) / Math.log(2)) + 1;
			SpT = new int[n][k];
			
			for (int i = 0; i < n; i++) {
				SpT[i][0] = i; 					// RMQ of sub array starting at index i and of length 2^0=1
			}
			//overall time complexity = O(n log n)
			for (int j = 1; (1<<j) <= n; j++) 				
				for (int i = 0; i + (1<<j) - 1 < n; i++)    
					if (A[SpT[i][j-1]] < A[SpT[i+(1<<(j-1))][j-1]])
						SpT[i][j] = SpT[i][j-1];    		// start at index i of length 2^(j-1)
					else			      					// start at index i+2^(j-1) of length 2^(j-1)
						SpT[i][j] = SpT[i+(1<<(j-1))][j-1];
		 }

		  int query(int i, int j) 
		  {
			  
		    int k = (int)Math.floor(Math.log(j-i+1) / Math.log(2)); // 2^k <= (j-i+1)
		    
		    if (A[SpT[i][k]] <= A[SpT[j-(1<<k)+1][k]]) 
		    	return SpT[i][k];
		    else
		    	return SpT[j-(1<<k)+1][k];
		  } 
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}