#include <bits/stdc++.h>
using namespace std;
struct Point {
  long long x, y, p;
};
bool comp(const Point& a, const Point& b) {
  if (a.x == b.x) return a.y > b.y;
  return a.x < b.x;
}
bool comp1(const Point& a, const Point& b) { return (a.y > b.y && a.x == b.x); }
int main() {
  long long n;
  Point a[300005];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].x >> a[i].y;
    a[i].p = i;
  }
  sort(a, a + n, comp);
  long long ymax = a[0].y, pos = a[0].p;
  for (int i = 1; i < n; i++) {
    if (a[i].y <= ymax) {
      cout << a[i].p + 1 << " " << pos + 1;
      return 0;
    } else {
      ymax = a[i].y;
      pos = a[i].p;
    }
  }
  cout << "-1 -1" << endl;
  return 0;
}
