#include <bits/stdc++.h>
using namespace std;
long long const delta = 1000000007;
int main() {
  std::ios::sync_with_stdio(0);
  ;
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long f, s;
  pair<pair<long long, long long>, long long> points[n];
  for (long long i = 0; i < n; i++) {
    cin >> f >> s;
    points[i] = make_pair(make_pair(f, s), i);
  }
  sort(points, points + n);
  long long last = -100, mmax;
  for (long long i = 0; i < n; i++) {
    if (i && points[i].first.first == points[i - 1].first.first) {
      if (points[i].first.second > points[i - 1].first.second) {
        return cout << points[i - 1].second + 1 << " " << points[i].second + 1,
               0;
      } else
        return cout << points[i].second + 1 << " " << points[i - 1].second + 1,
               0;
    }
    if (points[i].first.second > last) {
      last = points[i].first.second;
      mmax = points[i].second;
      continue;
    }
    if (points[i].first.second <= last)
      return cout << points[i].second + 1 << " " << mmax + 1, 0;
  }
  cout << -1 << " " << -1;
  return 0;
}
