#include <bits/stdc++.h>
using namespace std;
struct seg {
  long long int l;
  long long int r;
  long long int ix;
};
bool comp(seg a, seg b) {
  if (a.l != b.l)
    return a.l < b.l;
  else
    return a.r > b.r;
}
int main() {
  long long int n;
  cin >> n;
  seg segs[n];
  for (long long int i = 0; i < n; i++) {
    cin >> segs[i].l >> segs[i].r;
    segs[i].ix = i;
  }
  sort(segs, segs + n, comp);
  long long int maxr = 0;
  long long int res1 = -1, res2 = -1;
  for (long long int i = 1; i < n; i++) {
    if (segs[i].r <= segs[maxr].r) {
      res1 = segs[i].ix + 1;
      res2 = segs[maxr].ix + 1;
      break;
    }
    maxr = i;
  }
  cout << res1 << " " << res2 << endl;
  return 0;
}
