#include <bits/stdc++.h>
using namespace std;
long long int l[300005], r[300005], pos[300005];
bool cmp(int x, int y) {
  if (l[x] == l[y]) return r[x] > r[y];
  return (l[x] < l[y]);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    pos[i] = i;
  }
  sort(pos, pos + n, cmp);
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (l[pos[j]] > r[pos[i]]) break;
      if (r[pos[j]] > r[pos[i]]) break;
      if (r[pos[j]] <= r[pos[i]]) {
        cout << pos[j] + 1 << " " << pos[i] + 1 << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1" << endl;
  return 0;
}
