#include <bits/stdc++.h>
using namespace std;
template <class T>
void printVector(const vector<T>& res) {
  if (res.empty()) {
    cout << "Empty vector" << endl;
    return;
  }
  copy(res.begin(), res.end(), ostream_iterator<T>(std::cout, " "));
  cout << endl;
}
vector<pair<pair<long long, long long>, int> > intervals;
int num = 0;
bool comp(pair<pair<long long, long long>, int> i1,
          pair<pair<long long, long long>, int> i2) {
  if (i1.first.first == i2.first.first)
    return i1.first.second > i2.first.second;
  return i1.first.first < i2.first.first;
}
int main() {
  cin >> num;
  long long l, r;
  for (int i = 0; i < num; i++) {
    cin >> l >> r;
    pair<long long, long long> coord(l, r);
    pair<pair<long long, long long>, int> member(coord, i);
    intervals.push_back(member);
  }
  sort(intervals.begin(), intervals.end(), comp);
  int indexBiggerCandidate = 0;
  for (int i = 1; i < num; i++) {
    if (intervals.at(i).first.second <=
        intervals.at(indexBiggerCandidate).first.second) {
      cout << intervals.at(i).second + 1 << " "
           << intervals.at(indexBiggerCandidate).second + 1 << endl;
      return 0;
    } else {
      indexBiggerCandidate = i;
    }
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}
