#include <bits/stdc++.h>
using namespace std;
struct node {
  int lft, rgt;
  int pos;
};
bool cmpr(struct node a, struct node b) {
  if (a.lft < b.lft) return 1;
  if (a.lft > b.lft)
    return 0;
  else
    return a.rgt > b.rgt;
}
int main() {
  int n, i, m, k, x, y;
  cin >> n;
  struct node arr[n + 2];
  for (i = 1; i <= n; i++) {
    cin >> arr[i].lft;
    cin >> arr[i].rgt;
    arr[i].pos = i;
  }
  sort(arr + 1, arr + n + 1, cmpr);
  int flg = 0, fin = -1;
  x = -1;
  y = -1;
  for (i = 1; i <= n; i++) {
    if (arr[i].rgt <= fin) {
      flg = 1;
      break;
    }
    fin = arr[i].rgt;
  }
  if (flg == 1) {
    cout << arr[i].pos << " " << arr[i - 1].pos;
  } else
    cout << -1 << " " << -1;
}
