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