#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int x, y;
  int mn;
  cin >> mn;
  int mx;
  cin >> mx;
  int idx = 1;
  int mne = mn;
  int mxe = mx;
  for (int i = 1; i < n; ++i) {
    cin >> x >> y;
    if (x <= mn && y >= mx) {
      idx = i + 1;
      mn = x;
      mx = y;
    }
    if (x <= mne) mne = x;
    if (y >= mxe) mxe = y;
  }
  if (mn == mne && mx == mxe)
    cout << idx;
  else
    cout << -1;
  return 0;
}
