#include <bits/stdc++.h>
using namespace std;
const int N = 200002;
int n, mxR[N];
pair<pair<int, int>, int> a[N];
int getMaxR(int i, int last) {
  if (mxR[i] != -1) return mxR[i];
  last = max(last, a[i].first.second);
  if (i >= n || last + 1 < a[i + 1].first.first) return last;
  return mxR[i] = getMaxR(i + 1, last);
}
int main() {
  scanf("%d", &n);
  for (int(i) = (1); (i) <= (int)(n); (i)++)
    scanf("%d%d", &a[i].first.first, &a[i].first.second), a[i].second = i;
  sort(a + 1, a + n + 1,
       [](pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
         return a.first.first < b.first.first ||
                (a.first.first == b.first.first &&
                 a.first.second > b.first.second);
       });
  int last = -2;
  memset(mxR, -1, sizeof mxR);
  for (int(i) = (1); (i) <= (int)(n); (i)++) {
    if (last >= a[i].first.second || (last + 1 >= a[i + 1].first.first &&
                                      getMaxR(i + 1, 0) >= a[i].first.second))
      return printf("%d\n", a[i].second), 0;
    last = max(last, a[i].first.second);
  }
  printf("-1\n");
  return 0;
}
