#include <bits/stdc++.h>
using namespace std;
struct P {
  int first, second, index;
};
const int Max = 3e5 + 10;
P seg[Max];
bool cmp(P a, P b) {
  if (a.first <= b.first) {
    if (a.first == b.first)
      return a.second > b.second;
    else
      return 1;
  } else
    return 0;
}
int main() {
  ios::sync_with_stdio(false);
  int n, flag = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> seg[i].first >> seg[i].second;
    seg[i].index = i + 1;
  }
  sort(seg, seg + n, cmp);
  for (int i = 1; i < n; i++) {
    if (seg[i].second <= seg[i - 1].second) {
      flag = 1;
      cout << seg[i].index << " " << seg[i - 1].index << endl;
      break;
    }
  }
  if (!flag) cout << "-1 -1" << endl;
  return 0;
}
