#include <bits/stdc++.h>
using namespace std;
pair<pair<long long, long long>, long long> arr[300005];
signed main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    arr[i] = {{x, y}, i + 1};
  }
  sort(arr, arr + n);
  for (long long i = 0; i < n - 1; i++) {
    if (arr[i].first.first == arr[i + 1].first.first) {
      cout << arr[i].second << " " << arr[i + 1].second;
      return 0;
    }
    if (arr[i].first.second >= arr[i + 1].first.second) {
      cout << arr[i + 1].second << " " << arr[i].second;
      return 0;
    }
  }
  cout << -1 << " " << -1;
  return 0;
}
