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.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class CodeForces {

    public static void main(String[] args) throws IOException {
        in.init(System.in);
        StringBuilder out = new StringBuilder();
        int n = in.nextInt();
        Pair<Integer, Integer> pairs[] = new Pair[n];
        ArrayList<Pair<Character, Pair<Integer, Integer>>> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            pairs[i] = new Pair(in.nextInt(), in.nextInt());
            list.add(new Pair<>('s', pairs[i]));
            list.add(new Pair<>('e', pairs[i]));
        }
        if (n == 1) {
            System.out.print(String.format("%s %s\n", -1, -1));
            return;
        }
        Collections.sort(list, new Comparator<Pair<Character, Pair<Integer, Integer>>>() {

            @Override
            public int compare(Pair<Character, Pair<Integer, Integer>> o1, Pair<Character, Pair<Integer, Integer>> o2) {
                int o1Val;
                int o2Val;
                int o1Type;
                int o2Type;
                if (o1.a == 's') {
                    o1Val = o1.b.a;
                    o1Type = 1;
                } else {
                    o1Val = o1.b.b;
                    o1Type = 2;
                }
                if (o2.a == 's') {
                    o2Val = o2.b.a;
                    o2Type = 1;
                } else {
                    o2Val = o2.b.b;
                    o2Type = 2;
                }
                if (o1Val != o2Val) {
                    return o1Val - o2Val;
                } else if (o1Type != o2Type) {
                    return o1Type - o2Type;
                }
                if (o1Type == 1) {
                    return o2.b.b - o1.b.b;
                } else if (o1Type == 2) {
                    return o2.b.a - o1.b.a;
                }
                return 0;
            }
        });
        boolean flag = false;
        Pair<Integer, Integer> p1 = null;
        Pair<Integer, Integer> p2 = null;
        for (int i = 0; i < n - 1; i++) {
            if (list.get(i).b.a.equals(list.get(i + 1).b.a) && list.get(i).b.b.equals(list.get(i + 1).b.b) && list.get(i).a.equals(list.get(i+1).a)) {
                p1 = list.get(i).b;
                p2 = list.get(i + 1).b;
                flag = true;
                break;
            }
        }
        boolean ff = false;
        if (!flag) {
            LinkedList<Pair<Integer, Integer>> list2 = new LinkedList<>();
            HashSet<Pair<Integer, Integer>> list3 = new HashSet<>();
            for (Pair<Character, Pair<Integer, Integer>> pair : list) {
                if (list3.contains(pair.b)) {
                    if (list2.size() > 1) {
                        if (list2.get(0) != pair.b) {
                            p1 = list2.get(0);
                            p2 = pair.b;
                            ff = true;
                            break;
                        }
                    }
                    list3.remove(pair.b);
                    list2.remove(0);
                } else {
                    list2.add(pair.b);
                    list3.add(pair.b);
                }
            }
        }
        if(!ff && !flag) {
            System.out.print(String.format("%s %s\n", -1, -1));
            return;
        }
        int ii = -1;
        int jj = -1;
        for (int i = 0; i < n; i++) {
            if(pairs[i].a == -1)
                continue;
            if(pairs[i].a.equals(p1.a) && pairs[i].b.equals(p1.b)) {
                ii = i;
                pairs[i].a = -1;
                pairs[i].b = -1;
                break;
            }
        }
        for (int i = 0; i < n; i++) {
            if(pairs[i].a == -1)
                continue;
            if(pairs[i].a.equals(p2.a) && pairs[i].b.equals(p2.b)) {
                jj = i;
                pairs[i].a = -1;
                pairs[i].b = -1;
                break;
            }
        }
        System.out.print(String.format("%s %s" ,jj+1,ii+1));
    }

}

class Pair<T, E> {

    T a;
    E b;

    public Pair(T a, E b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public String toString() {
        return String.format("(%s--> %s)", a, b);
    }

}

class in {

    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer(" ");
    }

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

    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static boolean hasNext() {
        return tokenizer.hasMoreTokens();
    }

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

    static int nextShort() throws IOException {
        return Short.parseShort(next());
    }

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

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