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.IOException;
import java.math.BigInteger;
import java.util.*;
import java.io.*;

public class ll {
    public static void main(String[] args) throws Exception {
        gg g = new gg();
    }

}

class gg {
    PrintWriter pw;
    int n, t[];

    gg() throws Exception {
        //      FScanner fs = new FScanner(new FileReader("input.txt"));
        //  pw = new PrintWriter("multimap.out");
        FScanner fs = new FScanner(new InputStreamReader(System.in));
        pw = new PrintWriter(System.out);
        int n = fs.nextInt();
        long[][] a = new long[n][3];
        for (int i = 0; i<n; i++)
        {
            a[i][0] = fs.nextLong();
            a[i][1] = fs.nextLong();
            a[i][2] = i;
        }
        Arrays.sort(a, ((long[] c,long[] b) -> {
            if (c[0] == b[0])
                return -Long.compare(c[1], b[1]);
            else return Long.compare(c[0], b[0]);
        }));
        long cur = 0;
        long x, y;
        x = a[0][0];
        y = a[0][1];
        for (int i = 1; i < n; i++) {
            if (a[i][0] == a[i-1][0] && a[i][1] == a[i-1][1])
            {
                System.out.println(a[i][2] + 1 + " " + (a[i-1][2] + 1));
                System.exit(0);
            }
        }
        int[] pref = new int[n];
        for (int i = 1; i < n; i++) {
            if (a[i][1] > a[pref[i-1]][1])
                pref[i] = i;
            else pref[i] = pref[i-1];
        }
        for (int i = 1; i < n; i++)
        {
            long r = a[pref[i-1]][1];
            if (r >= a[i][1])
            {
                System.out.println(a[i][2] + 1 + " " + (a[pref[i-1]][2] + 1));
                System.exit(0);
            }
        }
        System.out.println(-1 + " " + (-1));
        pw.close();
    }

    private void del(Link[] np, int i) {
        if (np[i].prev == -1) {
            if (np[i].next < np.length && np[i].next >= 0) {
                np[np[i].next].prev = -1;
            }
        } else {
            np[np[i].prev].next = np[i].next;
            if (np[i].next != np.length)
                np[np[i].next].prev = np[i].prev;
        }
        np[i].prev = -2;
        np[i].next = -2;
    }

    private void org(Link[] np, int[] a) {
        int a1 = -1, a2 = 0, a3 = a.length;
        Link prev = null;
        for (int i = 0; i < np.length; i++)
            np[i] = new Link();
        while (a2 < a.length) {
            while (a2 < a.length && a[a2] == 0)
                a2++;
            if (a2 >= a.length)
                break;
            np[a2] = new Link();
            np[a2].prev = a1;
            if (prev != null)
                prev.next = a2;
            prev = np[a2];
            a2++;
        }
        if (prev != null)
            prev.next = a.length;

    }

    void build(int a[], int v, int tl, int tr) {
        if (tl == tr)
            t[v] = a[tl] != 0 ? tl : -1;
        else {
            int tm = (tl + tr) / 2;
            build(a, v * 2, tl, tm);
            build(a, v * 2 + 1, tm + 1, tr);
            t[v] = Math.max(t[v * 2], t[v * 2 + 1]);
        }
    }

    int sum(int v, int tl, int tr, int l, int r) {
        if (l > r)
            return -1;
        if (l == tl && r == tr)
            return t[v];
        int tm = (tl + tr) / 2;
        return Math.max(sum(v * 2, tl, tm, l, Math.min(r, tm))
                , sum(v * 2 + 1, tm + 1, tr, Math.max(l, tm + 1), r));
    }

    void update(int v, int tl, int tr, int pos, int[] a) {
        if (tl == tr)
            t[v] = a[tl] == 0 ? -1 : t[v];
        else {
            int tm = (tl + tr) / 2;
            if (pos <= tm)
                update(v * 2, tl, tm, pos, a);
            else
                update(v * 2 + 1, tm + 1, tr, pos, a);
            t[v] = Math.max(t[v * 2], t[v * 2 + 1]);
        }
    }
}

class Link {
    int prev, next;
}

class Pair implements Comparable<Pair> {
    long a;
    int x;

    Pair(long x1, int y1) {
        a = x1;
        a = y1;
    }

    @Override
    public int compareTo(Pair o) {
        if (a == o.a)
            return Integer.compare(x, o.x);
        else return Long.compare(a, o.a);
    }
}


class FScanner {
    StringTokenizer st;
    BufferedReader reader;

    FScanner(InputStreamReader isr) throws IOException {
        reader = new BufferedReader(isr);
    }

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

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

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

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) reader.read();
    }

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

    int[] iarr(int n) throws IOException {
        int[] mas = new int[n];
        for (int i = 0; i < n; i++)
            mas[i] = nextInt();
        return mas;
    }

    double[] darr(int n) throws IOException {
        double[] mas = new double[n];
        for (int i = 0; i < n; i++)
            mas[i] = nextDouble();
        return mas;
    }

    char[][] cmas2(int n, int m) throws IOException {
        char[][] mas = new char[n][m];
        for (int i = 0; i < n; i++)
            mas[i] = nextLine().toCharArray();
        return mas;
    }

    long[] larr(int n) throws IOException {
        long[] mas = new long[n];
        for (int i = 0; i < n; i++)
            mas[i] = nextLong();
        return mas;
    }
}

class PairP implements Comparable<PairP> {
    double l, r;

    PairP(double l1, double r1) {
        l = l1;
        r = r1;
    }

    @Override
    public int compareTo(PairP o) {
        if (l == o.l)
            return Double.compare(r, o.r);
        else return Double.compare(l, o.l);
    }
}