#include <bits/stdc++.h>
using namespace std;
priority_queue<long long, vector<long long>, greater<long long> > q;
pair<pair<long long, long long>, long long> a[300005];
bool com(pair<pair<long long, long long>, long long> x,
         pair<pair<long long, long long>, long long> y) {
  if (x.first.first == y.first.first) return x.first.second > y.first.second;
  return x.first.first < y.first.first;
}
int main() {
  long long n;
  while (cin >> n) {
    for (long long i = 1; i <= n; i++) {
      cin >> a[i].first.first;
      cin >> a[i].first.second;
      a[i].second = i;
    }
    sort(a + 1, a + n + 1, com);
    long long x = a[1].first.second;
    long long ans = a[1].second;
    for (long long i = 2; i <= n; i++) {
      if (a[i].first.second <= x) {
        cout << a[i].second << " " << ans << endl;
        return 0;
      }
      if (a[i].first.second > x) {
        ans = a[i].second;
        x = a[i].first.second;
      }
    }
    cout << -1 << " " << -1 << endl;
  }
}
