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.BufferedReader;
// import java.io.FileInputStream;
// import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

import static java.util.Arrays.fill;
import static java.util.Arrays.sort;
import static java.util.Collections.reverseOrder;

public class Main {
    FastScanner in;
    PrintWriter out;

    private void solve() throws IOException {
        solveC();
    }

    private void solveA() throws IOException {
        in.nextInt();
        StringBuilder s = new StringBuilder();
        boolean e = false;
        for (char c : in.next().toCharArray()) {
            if (c == '0')
                s.append(c);
            else if (!e) {
                e = true;
                s.append(c);
            }
        }
        out.println(s.toString());
    }

    private void solveB() throws IOException {
        long n = in.nextLong(), m = in.nextLong();
        long k = in.nextLong();
        if (k < n) {
            out.println((k + 1) + " " + 1);
        } else {
            k -= n;
            long i = k / (m - 1), j = k % (m - 1);
            if (i % 2 == 0) {
                out.println((n - i) + " " + (j + 2));
            } else {
                out.println((n - i) + " " + (m - j));
            }
        }
    }

    class Triplet implements Comparable<Triplet> {
        int x, id, pair;
        boolean end;

        Triplet(int x, boolean end, int id, int pair) {
            this.x = x;
            this.end = end;
            this.id = id;
            this.pair = pair;
        }

        @Override
        public int compareTo(Triplet o) {
            return x != o.x ? x - o.x :
                    (end != o.end ? Boolean.compare(end, o.end) :
                            (pair != o.pair ? o.pair - pair :
                                    (!end ? id - o.id : o.id - id)));
        }
    }

    class Pair implements Comparable<Pair> {
        int id, cmp;

        Pair(int i, int c) {
            id = i;
            cmp = c;
        }

        @Override
        public int compareTo(Pair o) {
            return cmp - o.cmp;
        }
    }

    private void solveC() throws IOException {
        int n = in.nextInt();
        Triplet[] p = new Triplet[n * 2];
        for (int i = 0; i < n; i++) {
            int l = in.nextInt(), r = in.nextInt();
            p[i * 2] = new Triplet(l, false, i, r);
            p[i * 2 + 1] = new Triplet(r, true, i, l);
        }
        shuffle(p);
        sort(p);
        TreeSet<Pair> set = new TreeSet<>();
        for (int i = 0; i < n * 2; i++) {
            if (p[i].end) {
                if (set.first().id == p[i].id) {
                    set.pollFirst();
                } else {
                    out.println((p[i].id + 1) + " " + (set.first().id + 1));
                    return;
                }
            } else {
                set.add(new Pair(p[i].id, i));
            }
        }
        out.println("-1 -1");
    }

    void shuffle(Triplet[] a) {
        Triplet b;
        Random r = new Random();
        for (int i = a.length - 1, j; i > 0; i--) {
            j = r.nextInt(i + 1);
            b = a[j];
            a[j] = a[i];
            a[i] = b;
        }
    }

    private void solveD() {

    }

    private void solveE() {

    }

    private void solveF() {

    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

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

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

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

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

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

        double nextDouble() throws IOException {
            return Double.parseDouble(next().replace(',', '.'));
        }

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

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

    }

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(".out"));

        solve();

        out.flush();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}
