#include <cstdio>
#include <cmath>
#include <cfloat>

using namespace std;

int main ()
{
#ifdef CONTEST
  freopen("242b.in", "rt", stdin);
  freopen("242b.out", "wt", stdout);
#endif

  int n;
  scanf("%d", &n);

  int a[n], b[n];
  int  min_a = 0, max_b = 0;
  int best_i;
  for(int i = 0; i < n; i++)
  {
    scanf("%d %d", &a[i], &b[i]);

    if(max_b - min_a <= b[i] - a[i])
      {
        max_b = b[i];
        min_a = a[i];
        best_i = i + 1;
      }
  }
  
  for(int i = 0; i < n; i++)
    {
      if(a[i] < min_a || b[i] > max_b)
        {
          printf("-1\n");
          return 0;
        }
    }
  printf("%d\n", best_i);
  
  return 0;
}