#include <bits/stdc++.h>
using namespace std;
int INF = 1000000000;
int n;
int mf = INF, mt, id, Mt;
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int f, t;
    scanf("%d%d", &f, &t);
    if (mf > f || (mf == f) && mt < t) {
      id = i;
      mf = f;
      mt = t;
    }
    if (Mt < t) Mt = t;
  }
  if (mt == Mt)
    printf("%d\n", id + 1);
  else
    printf("-1\n");
  return 0;
}
