#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
constexpr int mod = 1e9 + 7;
constexpr int inf = (1 << 30) - 1;
constexpr ll infll = (1LL << 61) - 1;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int N;
  cin >> N;
  map<pair<int, int>, int> mp;
  vector<pair<int, int>> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v[i].first >> v[i].second;
    if (mp[v[i]] != 0) {
      cout << mp[v[i]] << " " << i + 1 << "\n";
      return 0;
    }
    mp[v[i]] = i + 1;
    v[i].second *= -1;
  }
  sort(v.begin(), v.end());
  set<int> st;
  int ans1 = -1, ans2 = -1;
  for (int i = 0; i < N; i++) {
    v[i].second *= -1;
    st.erase(st.begin(), st.lower_bound(v[i].first));
    if (!st.empty() && st.lower_bound(v[i].second) != st.end()) {
      ans1 = i;
    }
    st.insert(v[i].second);
  }
  if (ans1 == -1) {
    cout << -1 << " " << -1 << "\n";
    return 0;
  }
  for (int i = 0; i < N; i++) {
    if (i == ans1) continue;
    if (v[i].first <= v[ans1].first && v[ans1].second <= v[i].second) ans2 = i;
  }
  cout << mp[v[ans1]] << " " << mp[v[ans2]] << "\n";
}
