#include <bits/stdc++.h>
using namespace std;
int n, aux[202020 * 6], first[202020], second[202020], rmq[202020 * 6][19];
int query(int l, int r) {
  int k = __builtin_clz(1) - __builtin_clz(r - l + 1);
  return min(rmq[l][k], rmq[r - (1 << k) + 1][k]);
}
int main() {
  scanf("%d", &n);
  for (int(i) = (0); (i) < (n); (i)++) {
    scanf("%d%d", first + i, second + i);
    aux[6 * i + 0] = first[i];
    aux[6 * i + 1] = second[i];
    aux[6 * i + 2] = first[i] + 1;
    aux[6 * i + 3] = second[i] + 1;
    aux[6 * i + 4] = first[i] - 1;
    aux[6 * i + 5] = second[i] - 1;
  }
  sort(aux, aux + 6 * n);
  int tn = unique(aux, aux + 6 * n) - aux;
  for (int(i) = (0); (i) < (n); (i)++) {
    first[i] = lower_bound(aux, aux + tn, first[i]) - aux,
    second[i] = lower_bound(aux, aux + tn, second[i]) - aux;
    rmq[first[i]][0]++;
    rmq[second[i] + 1][0]--;
  }
  for (int(i) = (1); (i) < (202020 * 6); (i)++) rmq[i][0] += rmq[i - 1][0];
  for (int(j) = (1); (j) < (19); (j)++)
    for (int(i) = (0); (i) < (202020 * 6); (i)++) {
      rmq[i][j] = rmq[i][j - 1];
      int pi = i + (1 << (j - 1));
      if (pi < 202020 * 6) rmq[i][j] = min(rmq[i][j], rmq[pi][j - 1]);
    }
  for (int(i) = (0); (i) < (n); (i)++)
    if (query(first[i], second[i]) > 1) {
      printf("%d\n", i + 1);
      return 0;
    }
  puts("-1");
}
