#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> v;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back({a, b, i});
  }
  sort(v.begin(), v.end());
  int f = 0;
  pair<int, int> ans;
  for (int i = 1; i < n; i++) {
    if (v[i][0] == v[i - 1][0]) {
      if (v[i][1] >= v[i - 1][1]) {
        f = 1;
        ans.first = v[i - 1][2];
        ans.second = v[i][2];
        break;
      }
    } else if (v[i][1] <= v[i - 1][1]) {
      f = 1;
      ans.first = v[i][2];
      ans.second = v[i - 1][2];
      break;
    }
  }
  if (f == 1)
    cout << ans.first + 1 << " " << 1 + ans.second;
  else
    cout << -1 << " " << -1;
  return 0;
}
