#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, l, r;
  cin >> n;
  pair<pair<long long, long long>, long long> lr[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> lr[i].first.first >> lr[i].first.second;
    lr[i].second = i;
  }
  sort(lr + 1, lr + n + 1);
  for (long long i = 2; i <= n; i++) {
    if (lr[i].first.second <= lr[i - 1].first.second) {
      return cout << lr[i].second << " " << lr[i - 1].second, 0;
    }
    if (lr[i].first.first == lr[i - 1].first.first) {
      return cout << lr[i - 1].second << " " << lr[i].second, 0;
    }
  }
  cout << "-1 -1";
}
