#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 99;
struct seg {
  int l, r, id;
} a[N];
int n, minr, u;
bool cmp(seg a, seg b) {
  if (a.l != b.l) return a.l > b.l;
  return a.r < b.r;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].l, &a[i].r), a[i].id = i;
  sort(a + 1, a + n + 1, cmp);
  if (n == 1) {
    printf("-1 -1");
    return 0;
  }
  u = a[1].id;
  minr = a[1].r;
  for (int i = 2; i <= n; i++) {
    if (minr <= a[i].r) {
      printf("%d %d", u, a[i].id);
      return 0;
    }
    if (a[i].r < minr) {
      u = a[i].id;
      minr = a[i].r;
    }
  }
  printf("-1 -1");
}
