#include <bits/stdc++.h>
using namespace std;
int l[300010], r[300010];
int id[300010];
int n;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> l[i] >> r[i];
  for (int i = 1; i <= n; i++) id[i] = i;
  sort(id + 1, id + n + 1, [&](int u, int v) {
    if (l[u] == l[v]) return r[u] > r[v];
    return l[u] < l[v];
  });
  int mx = 0;
  int ID = -1, JD = -1;
  for (int i = 1; i <= n; i++) {
    if (mx >= r[id[i]]) {
      cout << id[i] << " " << ID << endl;
      return 0;
    }
    mx = r[id[i]], ID = id[i];
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}
