#include <bits/stdc++.h>
using namespace std;
bool comp(pair<pair<int, int>, int> p1, pair<pair<int, int>, int> p2) {
  if (p1.first.first != p2.first.first) return p1.first.first < p2.first.first;
  return p1.first.second > p2.first.second;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<pair<int, int>, int> > v;
  int a, b;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    v.push_back(make_pair(make_pair(a, b), i + 1));
  }
  sort(v.begin(), v.end(), comp);
  for (int i = v.size() - 2; i >= 0; i--) {
    if (v[i].first.second >= v[i + 1].first.second) {
      printf("%d %d", v[i + 1].second, v[i].second);
      return 0;
    }
  }
  printf("-1 -1");
  return 0;
}
