#include <bits/stdc++.h>
using namespace std;
int min(int x, int y) {
  if (x < y)
    return x;
  else
    return y;
}
int main() {
  int n;
  cin >> n;
  int num = 1, ll, rr;
  cin >> ll >> rr;
  int l, r;
  for (int i = 2; i <= n; ++i) {
    cin >> l >> r;
    if (l <= ll && r >= rr) {
      num = i;
      ll = l;
      rr = r;
    } else {
      if (l < ll) {
        ll = l;
        num = -1;
      }
      if (r > rr) {
        rr = r;
        num = -1;
      }
    }
  }
  cout << num;
  return 0;
}
