#include <bits/stdc++.h>
const int N = 3e5 + 1;
int l[N], r[N], n, k[N];
bool cmp(int a, int b) { return l[a] == l[b] ? r[a] > r[b] : l[a] < l[b]; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &l[i], &r[i]), k[i] = i;
  std::sort(k + 1, k + n + 1, cmp);
  for (int j = 2; j <= n; ++j) {
    int i = k[j];
    if (r[i] <= r[k[j - 1]]) return printf("%d %d", i, k[j - 1]), 0;
  }
  return puts("-1 -1"), 0;
}
