#include <bits/stdc++.h>
using namespace std;
long long n, mx = -1, mn = 1e16, l = 1e10, r, x, y;
long long const N = 3 * 1e5 + 10;
pair<pair<long long, long long>, long long> p[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> x >> y, p[i].second = i, p[i].first = make_pair(x, -1 * y);
  sort(p, p + n, greater<pair<pair<long long, long long>, long long> >());
  for (int i = 0; i < n; i++) {
    if (mn > -1 * p[i].first.second) {
      mn = -1 * p[i].first.second, r = p[i].second;
    } else if (-1 * p[i].first.second >= mn) {
      l = p[i].second;
      break;
    }
  }
  if (l == r)
    cout << p[1].second + 1 << " " << p[0].second + 1;
  else if (l == 1e10)
    cout << -1 << " " << -1;
  else
    cout << r + 1 << " " << l + 1;
  return 0;
}
