#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
int n, l, r;
vector<pair<pair<int, int>, int> > a;
bool cmpf(const pair<pair<int, int>, int> &a,
          const pair<pair<int, int>, int> &b) {
  if (a.first.first != b.first.first)
    return a.first.first < b.first.first;
  else
    return a.first.second > b.first.second;
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    a.push_back(make_pair(make_pair(l, r), i));
  }
  sort(a.begin(), a.end(), cmpf);
  int rt, ri, li;
  rt = a[0].first.second;
  ri = a[0].second;
  li = -1;
  for (int i = 1; i < n; i++) {
    if (a[i].first.second <= rt) {
      li = a[i].second;
      break;
    } else {
      rt = a[i].first.second;
      ri = a[i].second;
    }
  }
  if (li == -1)
    cout << "-1 -1";
  else
    cout << li + 1 << " " << ri + 1;
  return 0;
}
