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 Main {

    static class Segment {
        int l, r, orgIndx;

        Segment(int l, int r, int orgIndx) {
            this.l = l;
            this.r = r;
            this.orgIndx = orgIndx;
        }
    }

    private static void solve(InputReader in, OutputWriter out) {
        int n = in.nextInt();

        Segment[] ar = new Segment[n];
        for (int i = 0; i < n; i++) {
            ar[i] = new Segment(in.nextInt(), in.nextInt(), i);
        }

        shuffleArray(ar);
        Arrays.sort(ar, (o1, o2) -> {
            if (o1.l < o2.l)
                return -1;
            else if (o1.l > o2.l)
                return 1;
            else {
                return Integer.compare(o2.r, o1.r);
            }
        });

        if (n == 1)
            out.print(-1 + " " + -1);
        else {
            Segment curSeg = ar[0];
            boolean isFound = false;

            for (int i = 1; i < n; i++) {
                if (ar[i].l <= curSeg.r) {
                    if (ar[i].r <= curSeg.r) {
                        isFound = true;
                        out.print((ar[i].orgIndx + 1) + " " + (curSeg.orgIndx + 1));
                        break;
                    } else {
                        curSeg = ar[i];
                    }
                } else {
                    curSeg = ar[i];
                }
            }

            if (!isFound)
                out.print(-1 + " " + -1);
        }
    }

    private static void shuffleArray(Segment[] array) {
        int index;
        Random random = new Random();
        for (int i = array.length - 1; i > 0; i--) {
            index = random.nextInt(i + 1);
            if (index != i) {
                Segment tmp = array[i];
                array[i] = array[index];
                array[index] = tmp;
            }
        }
    }


    private static void shuffleArray(int[] array) {
        int index;
        Random random = new Random();
        for (int i = array.length - 1; i > 0; i--) {
            index = random.nextInt(i + 1);
            if (index != i) {
                array[index] ^= array[i];
                array[i] ^= array[index];
                array[index] ^= array[i];
            }
        }
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        solve(in, out);
        in.close();
        out.close();
    }

    private static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        InputReader(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }

        String nextLine() {
            String line = null;
            try {
                line = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return line;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) return null;
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        byte nextByte() {
            return Byte.parseByte(next());
        }

        short nextShort() {
            return Short.parseShort(next());
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    private static class OutputWriter {
        BufferedWriter bw;

        OutputWriter(OutputStream os) {
            bw = new BufferedWriter(new OutputStreamWriter(os));
        }

        void print(int i) {
            print(Integer.toString(i));
        }

        void println(int i) {
            println(Integer.toString(i));
        }

        void print(long l) {
            print(Long.toString(l));
        }

        void println(long l) {
            println(Long.toString(l));
        }

        void print(double d) {
            print(Double.toString(d));
        }

        void println(double d) {
            println(Double.toString(d));
        }

        void print(boolean b) {
            print(Boolean.toString(b));
        }

        void println(boolean b) {
            println(Boolean.toString(b));
        }

        void print(char c) {
            try {
                bw.write(c);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        void println(char c) {
            println(Character.toString(c));
        }

        void print(String s) {
            try {
                bw.write(s);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        void println(String s) {
            print(s);
            print('\n');
        }

        void close() {
            try {
                bw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
