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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Set;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
import java.util.Map;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Reader in = new Reader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Reader in, PrintWriter out) {
            int n = in.ni();

            final List<TaskC.Segment> segments = new ArrayList<>(n);

            final Comparator<TaskC.Segment> comparator = (o1, o2) -> {
                if (o1.left < o2.left) {
                    return -1;
                } else if (o1.left > o2.left) {
                    return 1;
                }
                return o1.index - o2.index;
            };

            segments.sort(comparator);

            final Set<Integer> borders = new HashSet<>();

            for (int i = 0; i < n; i++) {
                final TaskC.Segment segment = new TaskC.Segment(i, in.ni(), in.ni());
                segments.add(segment);

                borders.add(segment.left);
                borders.add(segment.right);
            }

            final List<Integer> bordersSorted = new ArrayList<>(borders);
            bordersSorted.sort(Integer::compareTo);

            Map<Integer, List<TaskC.Segment>> opens = new HashMap<>();
            Map<Integer, List<TaskC.Segment>> closes = new HashMap<>();

            for (TaskC.Segment segment : segments) {
                final List<TaskC.Segment> current = opens.computeIfAbsent(segment.left, k -> new ArrayList<>());
                current.add(segment);
            }

            for (TaskC.Segment segment : segments) {
                final List<TaskC.Segment> current = closes.computeIfAbsent(segment.right, k -> new ArrayList<>());
                current.add(segment);
            }

            final List<TaskC.Segment> active = new ArrayList<>(n);
            int left = 0;

            final boolean[] used = new boolean[n];

            for (Integer border : bordersSorted) {
                final List<TaskC.Segment> openedAtBorder = opens.get(border);
                if (openedAtBorder != null) {
                    active.addAll(openedAtBorder);
                }

                final List<TaskC.Segment> closedAtBorder = closes.get(border);
                if (closedAtBorder != null) {
                    for (TaskC.Segment it : closedAtBorder) {
                        used[it.index] = true;
                    }
                }

                while (left < active.size() && used[active.get(left).index]) {
                    left++;
                }

                if (closedAtBorder != null && !closedAtBorder.isEmpty()) {
                    if (closedAtBorder.size() > 1) {
                        final List<TaskC.Segment> sub = closedAtBorder.subList(0, 2);
                        sub.sort(comparator);
                        out.println((sub.get(1).index + 1) + " " + (sub.get(0).index + 1));
                        return;
                    } else {
                        if (left < active.size() && !used[active.get(left).index]) {
                            final TaskC.Segment mostLeft = active.get(left);
                            final TaskC.Segment closed = closedAtBorder.get(0);
                            if (mostLeft != null && mostLeft.left <= closed.left) {
                                out.println((closed.index + 1) + " " + (mostLeft.index + 1));
                                return;
                            }
                        }
                    }
                }
            }

            out.println("-1 -1");
        }

        public static class Segment {
            public final int index;
            public final int left;
            public final int right;

            public Segment(int index, int left, int right) {
                this.index = index;
                this.left = left;
                this.right = right;
            }


            public boolean equals(Object obj) {
                if (obj instanceof TaskC.Segment) {
                    final TaskC.Segment another = (TaskC.Segment) obj;
                    return left == another.left && right == another.right && index == another.index;
                }
                return false;
            }

        }

    }

    static class Reader {
        private static final String DELIMITER = " ";
        private StringTokenizer st = new StringTokenizer("");
        private final BufferedReader in;

        public Reader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        @SuppressWarnings("WeakerAccess")
        public String next() {
            if (!st.hasMoreTokens()) {
                st = new StringTokenizer(rl());
            }
            return st.nextToken(DELIMITER);
        }

        @SuppressWarnings("WeakerAccess")
        public String rl() {
            try {
                return in.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int ni() {
            return Integer.parseInt(next());
        }

    }
}

