#include <bits/stdc++.h>
using namespace std;
string s;
long long n, rights, lefts, a, b, outer;
vector<pair<int, pair<int, int>>> segments;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    segments.push_back(std::make_pair(a, std::make_pair(b, i)));
  }
  sort(segments.begin(), segments.end());
  for (int i = 0; i < n; i++) {
    long long first = segments.at(i).first;
    pair<int, int> second = segments.at(i).second;
    if (second.first > rights) {
      if (first == lefts) {
        cout << outer + 1 << " " << second.second + 1;
        return 0;
      }
      rights = second.first;
      lefts = first;
      outer = second.second;
    } else {
      cout << second.second + 1 << " " << outer + 1;
      return 0;
    }
  }
  cout << -1 << " " << -1;
  return 0;
}
