#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y, ind;
} p[300010];
int n;
bool cmp(node b, node a) {
  if (a.x != b.x)
    return a.x < b.x;
  else
    return a.y > b.y;
}
int main() {
  cin >> n;
  int i, j;
  for (i = 1; i <= n; ++i) {
    p[i].ind = i;
    cin >> p[i].x >> p[i].y;
  }
  sort(p + 1, p + 1 + n, cmp);
  int h = 1;
  for (i = 2; i <= n; ++i) {
    if (p[i].y >= p[h].y) {
      cout << p[h].ind << ' ' << p[i].ind;
      return 0;
    } else
      h = i;
  }
  cout << -1 << ' ' << -1 << endl;
  return 0;
}
