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. 
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const double pi = acos(-1);
const int inf = 2e9;
const int maxn = 1e6 + 15;
struct node {
  int l, r, pos;
} a[maxn];
int b[maxn];
int c[maxn];
int d;
void add(int x) {
  for (int i = x; d >= i; i += i & -i) {
    c[i]++;
  }
}
int query(int x) {
  int ans = 0;
  for (int i = x; i; i -= i & -i) {
    ans += c[i];
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  int tot = 0;
  for (int i = 1; n >= i; i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
    b[++tot] = a[i].l;
    b[++tot] = a[i].r;
    a[i].pos = i;
  }
  sort(b + 1, b + tot + 1);
  d = unique(b + 1, b + tot + 1) - b - 1;
  sort(a + 1, a + n + 1, [](node a, node b) {
    if (a.l == b.l) return a.r > b.r;
    return a.l < b.l;
  });
  for (int i = 1; n >= i; i++) {
    int pos = lower_bound(b + 1, b + d + 1, a[i].r) - b;
    int num = query(d) - query(pos - 1);
    if (num) {
      for (int j = 1; n >= j; j++) {
        if (a[j].l <= a[i].l && a[i].r <= a[j].r && i != j) {
          printf("%d %d\n", a[i].pos, a[j].pos);
          break;
        }
      }
      return 0;
    }
    add(pos);
  }
  printf("-1 -1\n");
  return 0;
}
