#include <bits/stdc++.h>
using namespace std;
int n;
struct node {
  int l, r, i;
} p[300005];
bool cmp(node a, node b) {
  if (a.l != b.l) return a.l < b.l;
  return a.r > b.r;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d%d", &p[i].l, &p[i].r), p[i].i = i;
  sort(p + 1, p + 1 + n, cmp);
  int now = 0;
  int pos;
  for (int i = 1; i <= n; i++) {
    if (p[i].r <= now) {
      cout << p[i].i << " " << p[pos].i << endl;
      return 0;
    }
    if (p[i].r > now) {
      now = p[i].r;
      pos = i;
    }
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}
