#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int n, ind;
pair<pair<int, int>, int> a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  if (n == 1) return cout << -1 << ' ' << -1, 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first.first >> a[i].first.second;
    a[i].first.second = -a[i].first.second;
    a[i].second = i;
  }
  sort(a, a + n);
  a[0].first.second = -a[0].first.second;
  for (int i = 1; i < n; i++) {
    a[i].first.second = -a[i].first.second;
    if (a[i].first.second <= a[i - 1].first.second)
      return cout << a[i].second + 1 << ' ' << a[i - 1].second + 1, 0;
  }
  return cout << -1 << ' ' << -1, 0;
}
