#include <bits/stdc++.h>
using namespace std;
const int MAXX = 3e5 + 10;
long long n;
pair<pair<long long, long long>, long long> a[MAXX];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i].first.first >> a[i].first.second, a[i].second = i + 1;
  sort(a, a + n,
       [&](pair<pair<long long, long long>, long long> x,
           pair<pair<long long, long long>, long long> y) {
         if (x.first.first == y.first.first)
           return (x.first.second > y.first.second);
         return x.first.first < y.first.first;
       });
  for (int i = 1; i < n; i++)
    if (a[i].first.second <= a[i - 1].first.second)
      return cout << a[i].second << " " << a[i - 1].second << endl, 0;
  return cout << "-1 -1" << endl, 0;
}
