#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<pair<pair<int, int>, int> > v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i].first.first >> v[i].first.second;
    v[i].first.second *= -1;
    v[i].second = i + 1;
  }
  sort(v.begin(), v.end());
  int r_max = -v[0].first.second;
  int i_max = v[0].second;
  for (int i = 1; i < n; i++) {
    v[i].first.second *= -1;
    if (v[i].first.second <= r_max) {
      cout << v[i].second << " " << i_max << "\n";
      return 0;
    }
    if (v[i].first.second > r_max)
      r_max = v[i].first.second, i_max = v[i].second;
  }
  cout << "-1 -1\n";
  return 0;
}
