#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, pair<long long, long long> > > v;
int main() {
  long long n;
  scanf("%lld", &n);
  long long a, b;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a), scanf("%lld", &b);
    v.push_back(make_pair(a, make_pair(b, i)));
  }
  sort(v.begin(), v.end());
  for (long long i = 1; i < v.size(); i++) {
    if (v[i].first >= v[i - 1].first and
        v[i].second.first <= v[i - 1].second.first) {
      long long x = v[i].second.second;
      long long y = v[i - 1].second.second;
      printf("%lld %lld\n", x, y);
      return 0;
    } else if (v[i].first <= v[i - 1].first and
               v[i].second.first >= v[i - 1].second.first) {
      long long x = v[i - 1].second.second;
      long long y = v[i].second.second;
      printf("%lld %lld\n", x, y);
      return 0;
    }
  }
  printf("-1 -1\n");
  return 0;
}
