#include <bits/stdc++.h>
using namespace std;
static int n, a, b;
static vector<pair<pair<int, int>, int> > ve;
static map<int, int> tp;
static map<pair<int, int>, vector<int> > hashs;
bool cmp_nest(pair<pair<int, int>, int>& p1, pair<pair<int, int>, int>& p2) {
  if (p1.first.first == p2.first.first)
    return p1.first.second > p2.first.second;
  return p1.first.first < p2.first.first;
}
int main() {
  while (scanf("%d", &n) != EOF) {
    ve.clear();
    tp.clear();
    hashs.clear();
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &a, &b);
      ve.push_back(make_pair(make_pair(a, b), i + 1));
    }
    int ans1 = -1;
    int ans2 = -1;
    sort(ve.begin(), ve.end(), cmp_nest);
    for (int i = 0; i < n; i++) {
      auto it = tp.lower_bound(ve[i].first.second);
      if (it != tp.end()) {
        auto p = make_pair(it->second, it->first);
        ;
        ans2 = hashs[p][0];
        ans1 = ve[i].second;
        break;
      }
      tp[ve[i].first.second] = ve[i].first.first;
      hashs[ve[i].first].push_back(ve[i].second);
    }
    printf("%d %d\n", ans1, ans2);
  }
  return 0;
}
