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.*;
import java.util.*;

public class CODEFORCES
{
	@SuppressWarnings("rawtypes")
	static InputReader in;
	static PrintWriter out;

	public static class SegmentTree
	{
		int n;
		int arr[], lazy[];

		SegmentTree(int n)
		{
			this.n = n;
			arr = new int[n << 2];
			Arrays.fill(arr, -1);
			lazy = new int[n << 2];
		}

		SegmentTree(int a[])
		{
			this.n = a.length;
			arr = new int[n << 2];
			lazy = new int[n << 2];
			build(0, n - 1, 0, a);
		}

		void build(int l, int r, int c, int a[])
		{
			if (l == r)
			{
				arr[c] = a[l];
				return;
			}
			int mid = l + r >> 1;
			build(l, mid, (c << 1) + 1, a);
			build(mid + 1, r, (c << 1) + 2, a);
			arr[c] = merge(arr[(c << 1) + 1], arr[(c << 1) + 2]);
		}

		int merge(int a, int b)
		{
			return Math.max(a, b);
		}

		int lazymerge(int a, int b)
		{
			return Math.max(a, b);
		}

		boolean getInitialValue(long a)
		{
			return !(a == 0);
		}

		void check(int c, int l, int r)
		{
			if (getInitialValue(lazy[c]))
			{
				arr[c] = lazymerge(arr[c], lazy[c]);
				if (l != r)
				{
					lazy[(c << 1) + 1] = lazymerge(lazy[(c << 1) + 1], lazy[c]);
					lazy[(c << 1) + 2] = lazymerge(lazy[(c << 1) + 2], lazy[c]);
				}
				lazy[c] = 0;
			}
		}

		void update(int l, int r, int c, int x, int y, int val)
		{
			check(c, l, r);
			if (l > r || x > y || l > y || x > r)
				return;
			if (x <= l && y >= r)
			{
				arr[c] = lazymerge(arr[c], val);
				if (l != r)
				{
					lazy[(c << 1) + 1] = lazymerge(lazy[(c << 1) + 1], val);
					lazy[(c << 1) + 2] = lazymerge(lazy[(c << 1) + 2], val);
				}
				return;
			}
			int mid = l + r >> 1;
			update(l, mid, (c << 1) + 1, x, y, val);
			update(mid + 1, r, (c << 1) + 2, x, y, val);
			arr[c] = merge(arr[(c << 1) + 1], arr[(c << 1) + 2]);
		}

		void up(int x, int y, int val)
		{
			update(0, n - 1, 0, x, y, val);
		}

		int get(int l, int r, int c, int x, int y)
		{
			check(c, l, r);
			if (l > r || x > y || l > y || x > r) // return inverse value
				return -1;
			else if (x <= l && y >= r)
				return arr[c];
			int mid = l + r >> 1;
			return merge(get(l, mid, (c << 1) + 1, x, y), get(mid + 1, r, (c << 1) + 2, x, y));
		}

		int ans(int x, int y)
		{
			return get(0, n - 1, 0, x, y);
		}
	}

	public static class Pair implements Comparable<Pair>
	{
		long u;
		long v;
		int ind;

		public Pair(long u, long v, int in)
		{
			this.u = u;
			this.v = v;
			ind = in;
		}

		public int hashCode()
		{
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o)
		{
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other)
		{
			return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(other.v, v);
		}

		public String toString()
		{
			return u + " " + v;
		}
	}

	static void solve()
	{
		int n = in.ni();
		Pair p[] = new Pair[n];
		for (int i = 0; i < n; i++)
			p[i] = new Pair(in.ni(), in.ni(), i + 1);
		Arrays.sort(p);
		long tmp[] = new long[n << 1];
		int cnt = 0;
		for (int i = 0; i < n; i++)
		{
			tmp[cnt++] = p[i].u;
			tmp[cnt++] = p[i].v;
		}
		Arrays.sort(tmp);
		int cnt2 = 0;
		HashMap<Long, Integer> map = new HashMap<Long, Integer>();
		for (int i = 0; i < cnt; i++)
		{
			if (map.containsKey(tmp[i]))
				continue;
			map.put(tmp[i], cnt2++);
		}
		SegmentTree t = new SegmentTree(cnt2 + 100);
		for (int i = 0; i < n; i++)
		{
			int get = t.ans(map.get(p[i].v), cnt2);
			if (get != -1)
			{
				out.println(p[i].ind + " " + get);
				return;
			}
			t.up(map.get(p[i].v), map.get(p[i].v), p[i].ind);
		}
		out.println("-1 -1");
	}

	static int[][] graph(int from[], int to[], int n, int cn)
	{
		int g[][] = new int[n][];
		int cnt[] = new int[n];
		for (int i = 0; i < cn; i++)
		{
			cnt[from[i]]++;
			// cnt[to[i]]++;
		}
		for (int i = 0; i < n; i++)
			g[i] = new int[cnt[i]];
		Arrays.fill(cnt, 0);
		for (int i = 0; i < cn; i++)
		{
			g[from[i]][cnt[from[i]]++] = to[i];
			// g[to[i]][cnt[to[i]]++] = from[i];
		}
		return g;
	}

	@SuppressWarnings("rawtypes")
	static void soln()
	{
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static void debug(Object... o)
	{
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args)
	{
		new Thread(null, new Runnable()
		{
			public void run()
			{
				try
				{
					soln();
				} catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	// To Get Input
	// Some Buffer Methods
	static class InputReader<SpaceCharFilter>
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int ni()
		{
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nl()
		{
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = ni();
			}
			return a;
		}

		public long[] nextLongArray(int n)
		{
			long a[] = new long[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nl();
			}
			return a;
		}

		public String readString()
		{
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}

	}
}