#include <bits/stdc++.h>
using namespace std;
pair<int, pair<int, int> > arr[300005];
bool cmp(pair<int, pair<int, int> > x, pair<int, pair<int, int> > y) {
  return x.first < y.first ||
         x.first == y.first && x.second.first > y.second.first;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int ans, mn = 2e9, n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i].first >> arr[i].second.first;
  for (int i = 0; i < n; i++) arr[i].second.second = i + 1;
  sort(arr, arr + n, cmp);
  for (int i = n - 1; i >= 0; i--) {
    if (arr[i].second.first < mn) {
      mn = arr[i].second.first;
      ans = arr[i].second.second;
    } else {
      cout << ans << " " << arr[i].second.second << endl;
      return 0;
    }
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}
