#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, f, s;
  cin >> n;
  multimap<int, int> mp;
  int pref, pres, no;
  for (int i = 0; i < n; i++) {
    cin >> f >> s;
    if (i == 0) {
      pref = f;
      pres = s;
      no = i + 1;
    } else {
      if (pref >= f && pres <= s) {
        pref = f;
        pres = s;
        no = i + 1;
      } else if (pref <= f && pres >= s)
        continue;
      else {
        no = -1;
        if (f < pref) pref = f;
        if (s > pres) pres = s;
      }
    }
  }
  cout << no << endl;
  return 0;
}
