#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int Maxn = 3e5 + 5;
pair<pair<int, int>, int> push[Maxn];
bool cmp(pair<pair<int, int>, int> x, pair<pair<int, int>, int> y) {
  if (x.first.first != y.first.first) return x.first.first < y.first.first;
  return x.first.second > y.first.second;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &push[i].first.first, &push[i].first.second);
    push[i].second = i;
  }
  sort(push + 1, push + 1 + n, cmp);
  int Mx = -1, Mxid = -1;
  for (int i = 1; i <= n; i++) {
    if (Mx >= push[i].first.second) {
      printf("%d %d\n", push[i].second, push[Mxid].second);
      return 0;
    }
    if (push[i].first.second > Mx) {
      Mx = push[i].first.second;
      Mxid = i;
    }
  }
  printf("-1 -1\n");
  return 0;
}
