#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, arr1[100005], arr2[100005], a = 0, b = 0, i;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    scanf("%d%d", &arr1[i], &arr2[i]);
    if (a == 0 && b == 0) {
      a = arr1[i];
      b = arr2[i];
    } else {
      a = min(a, arr1[i]);
      b = max(b, arr2[i]);
    }
  }
  for (i = 1; i <= t; i++) {
    if (a == arr1[i] && b == arr2[i]) break;
  }
  if (i == t + 1)
    printf("-1\n");
  else
    printf("%d\n", i);
  return 0;
}
