#include <bits/stdc++.h>
using namespace std;
pair<pair<int, int>, int> datas[300005];
int main() {
  int N;
  scanf("%d", &N);
  for (int a = 1; a <= N; a++) {
    scanf("%d %d", &datas[a].first.first, &datas[a].first.second);
    datas[a].second = a;
  }
  sort(datas + 1, datas + N + 1);
  int posy = -1, posx = -1;
  for (int a = 1; a < N; a++) {
    int L1 = datas[a].first.first, L2 = datas[a + 1].first.first,
        R1 = datas[a].first.second, R2 = datas[a + 1].first.second;
    int ix1 = datas[a].second, ix2 = datas[a + 1].second;
    if (L1 == L2) {
      posy = ix1;
      posx = ix2;
      break;
    } else if (R1 >= R2) {
      posy = ix2;
      posx = ix1;
    }
  }
  printf("%d %d\n", posy, posx);
  return 0;
}
