#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int x, y;
  long long int fir = 1000000001, sec = 0, ind;
  vector<pair<long long int, long long int> > v;
  for (long long int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(make_pair(x, y));
    if (sec <= y) {
      if (sec == y) {
        if (fir > x) {
          fir = x;
          ind = i + 1;
        }
      } else {
        sec = y;
        fir = x;
        ind = i + 1;
      }
    }
  }
  for (long long int i = 0; i < n; i++) {
    if (fir > v[i].first) {
      cout << "-1\n";
      return 0;
    }
  }
  cout << ind;
}
