#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l[100005], r[100005], a = 1 << 30, b = -1 << 30;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    a = min(a, l[i]);
    b = max(b, r[i]);
  }
  int bs = -1;
  for (int i = 0; i < n; i++) {
    if (l[i] <= a && b <= r[i]) {
      bs = i + 1;
    }
  }
  cout << bs << "\n";
}
