#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<pair<int, int>, int> a[n + 5];
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    a[i] = {{l, r}, i + 1};
  }
  sort(a, a + n);
  for (int i = 1; i < n; i++) {
    if (a[i].first.second <= a[i - 1].first.second) {
      cout << a[i].second << endl;
      return 0;
    }
    if (a[i].first.first <= a[i - 1].first.first &&
        a[i].first.second >= a[i - 1].first.second) {
      cout << a[i - 1].second << endl;
      return 0;
    }
    a[i].first.first = max(a[i].first.first, a[i - 1].first.second + 1);
  }
  cout << -1 << endl;
  return 0;
}
