#include <bits/stdc++.h>
using namespace std;
int read() {
  static int x;
  static char ch;
  static bool pd;
  pd = true;
  x = 0;
  for (ch = getchar(); ch > '9' || ch < '0'; ch = getchar())
    if (ch == '-') pd = false;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return pd ? x : -x;
}
struct node {
  int l, r, pos;
} a[300010];
int n;
bool cmp(node a, node b) {
  if (a.l <= b.l && b.r <= a.r) {
    printf("%d %d\n", b.pos, a.pos);
    exit(0);
  }
  if (a.l >= b.l && b.r >= a.r) {
    printf("%d %d\n", a.pos, b.pos);
    exit(0);
  }
  return a.l < b.l || (a.l == b.l && a.r < b.r);
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i].l = read(), a[i].r = read(), a[i].pos = i;
  sort(a + 1, a + 1 + n, cmp);
  puts("-1 -1");
  return 0;
}
