#include <bits/stdc++.h>
using namespace std;
const int MAX = 300005;
struct Node {
  int l, r, id;
  bool operator<(const Node &a) const {
    if (l == a.l) return r > a.r;
    return l < a.l;
  }
} aa[MAX];
int n, r, id;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> aa[i].l >> aa[i].r;
    aa[i].id = i;
  }
  sort(aa + 1, aa + 1 + n);
  id = aa[1].id;
  r = aa[1].r;
  for (int i = 2; i <= n; ++i) {
    if (aa[i].r <= r) {
      cout << aa[i].id << " " << id << endl;
      return 0;
    }
    r = aa[i].r;
    id = aa[i].id;
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}
