#include <bits/stdc++.h>
using namespace std;
int inters[(int)6e5 + 5];
pair<int, int> q[(int)2e5 + 5];
int vals[(int)6e5 + 5];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    q[i] = make_pair(l, r);
    vals[3 * i] = l;
    vals[3 * i + 1] = r;
    vals[3 * i + 2] = r + 1;
  }
  sort(vals, vals + 3 * N);
  int ind = 1;
  for (int i = 1; i < 3 * N; i++) {
    if (vals[i] == vals[i - 1]) continue;
    vals[ind++] = vals[i];
  }
  int Vsize = ind;
  for (int i = 0; i < N; i++) {
    int lind, rind;
    lind = lower_bound(vals, vals + Vsize, q[i].first) - vals;
    rind = lower_bound(vals, vals + Vsize, q[i].second) - vals;
    inters[lind]++;
    inters[rind + 1]--;
  }
  partial_sum(inters, inters + Vsize, inters);
  for (int i = 0; i < Vsize; i++) {
    if (inters[i] != 1) inters[i] = 0;
  }
  partial_sum(inters, inters + Vsize, inters);
  int save = -1;
  for (int i = 0; i < N; i++) {
    int lind, rind;
    lind = lower_bound(vals, vals + Vsize, q[i].first) - vals;
    rind = lower_bound(vals, vals + Vsize, q[i].second) - vals;
    int ones = inters[rind];
    if (lind > 0) ones -= inters[lind - 1];
    if (ones == 0) {
      save = i;
      break;
    }
  }
  if (save == -1)
    cout << -1;
  else {
    cout << save + 1;
  }
  return 0;
}
