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.util.*;
import java.util.function.*;
import java.io.*;
import java.math.*;
import java.awt.geom.*;
public class Main {
  public static final PrintWriter outWriter = new PrintWriter(System.out);
  public static final int _BUFFER_SIZE = 1 << 16;
  public static final DataInputStream _din = new DataInputStream(System.in);
  public static final byte[] _buffer = new byte[_BUFFER_SIZE];
  public static int _bufferPointer = 0, _bytesRead = 0;
  public static class Segment implements Comparable<Segment> {
    public long start;
    public long end;
    public int ndx;
    public long start() { return start; }
    public long end() { return end; }
    public int ndx() { return ndx; }
    Segment(long start_, long end_, int ndx_) { start=start_; end=end_; ndx=ndx_; }
    Segment() {
      this(nextLong(),nextLong(),nextInt());
    }
    public boolean equals(Object oo) {
      @SuppressWarnings("unchecked")
      Segment o = (Segment)oo;
      return o != null && start==o.start&&end==o.end&&ndx==o.ndx;
    }
    public int hashCode() { return Objects.hash(start,end,ndx); }
    public String toString() { return ""+start+","+end+","+ndx; }
    Comparator<Segment> cmp = Comparator.comparing(Segment::start).thenComparing(Comparator.comparing(Segment::end).reversed());
    public int compareTo(Segment that) {
      return cmp.compare(this, that);
    }
  }
  public static void main() {
    int n = nextInt();
    Segment[] ss = new Segment[n];
    for (int i = 0; i < ss.length; i++) {
      ss[i] = new Segment(nextLong(), nextLong(), i+1);
    }
    Arrays.sort(ss);
    Segment max = ss[0];
    for (int i = 1; i < n; i++) {
      Segment curr = ss[i];
      if (curr.end <= max.end) {
        outWriter.println(curr.ndx +" "+ max.ndx);
        return;
      } else {
        max = curr;
      }
    }
    outWriter.println("-1 -1");
  }
  public static void main(String[] args) { main(); outWriter.flush(); }
  public static void _fillBuffer() {
    try {
      _bytesRead = _din.read(_buffer, _bufferPointer = 0, _buffer.length);
      if (_bytesRead == -1)
        _buffer[0] = -1;
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  }
  public static byte _read() {
    if (_bufferPointer == _bytesRead)
      _fillBuffer();
    return _buffer[_bufferPointer++];
  }
  public static String next() {
    byte[] strBuf = new byte[64];
    int cnt = 0, c;
    while ((c = _read()) != -1) {
      if (Character.isWhitespace(c)) {
        if (cnt == 0) {
          continue;
        } else {
          break;
        }
      }
      if (strBuf.length == cnt) {
        strBuf = Arrays.copyOf(strBuf, strBuf.length*2);
      }
      strBuf[cnt++] = (byte) c;
    }
    return new String(strBuf, 0, cnt);
  }
  public static String nextLine() {
    byte[] strBuf = new byte[64];
    int cnt = 0, c;
    while ((c = _read()) != -1) {
      if (c == '\n') {
        if (cnt == 0) {
          continue;
        } else {
          break;
        }
      }
      if (strBuf.length == cnt) {
        strBuf = Arrays.copyOf(strBuf, strBuf.length*2);
      }
      strBuf[cnt++] = (byte) c;
    }
    return new String(strBuf, 0, cnt);
  }
  public static int nextInt() {
    int ret = 0;
    byte c = _read();
    while (c <= ' ')
      c = _read();
    boolean neg = (c == '-');
    if (neg)
      c = _read();
    do {
      ret = ret * 10 + c - '0';
    } while ((c = _read()) >= '0' && c <= '9');
    if (neg)
      return -ret;
    return ret;
  }
  public static long nextLong() {
    long ret = 0;
    byte c = _read();
    while (c <= ' ')
      c = _read();
    boolean neg = (c == '-');
    if (neg)
      c = _read();
    do {
      ret = ret * 10 + c - '0';
    } while ((c = _read()) >= '0' && c <= '9');
    if (neg)
      return -ret;
    return ret;
  }
  public static double nextDouble() {
    double ret = 0, div = 1;
    byte c = _read();
    while (c <= ' ')
      c = _read();
    boolean neg = (c == '-');
    if (neg)
      c = _read();
    do {
      ret = ret * 10 + c - '0';
    }
    while ((c = _read()) >= '0' && c <= '9');
    if (c == '.') {
      while ((c = _read()) >= '0' && c <= '9') {
        ret += (c - '0') / (div *= 10);
      }
    }
    if (neg)
      return -ret;
    return ret;
  }
}
