#include <bits/stdc++.h>
using namespace std;
int l[200005], r[200005], pre[1000005], ofs[1000005];
int main() {
  int n, i;
  scanf("%d", &n);
  set<int> s;
  map<int, int> ran;
  int ra = 1;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    s.insert(l[i]);
    s.insert(l[i] - 1);
    s.insert(r[i]);
  }
  set<int>::iterator I;
  for (I = s.begin(); I != s.end(); I++) ran[*I] = ra++;
  for (i = 1; i <= n; i++) {
    ofs[ran[l[i]]]++;
    ofs[ran[r[i]] + 1]--;
  }
  int cur = 0;
  for (i = 1; i <= ra; i++) {
    cur += ofs[i];
    if (cur == 1) pre[i] = 1;
  }
  for (i = 1; i <= ra; i++) pre[i] += pre[i - 1];
  int ans = -1;
  for (i = 1; i <= n; i++)
    if (pre[ran[r[i]]] == pre[ran[l[i]] - 1]) {
      ans = i;
      break;
    }
  printf("%d\n", ans);
  return 0;
}
