#include <bits/stdc++.h>
using namespace std;
struct infu {
  int f, s, id;
};
infu a[200005];
bool comp(infu x, infu y) {
  if (x.f == y.f) {
    return x.s > y.s;
  } else {
    return x.f < y.f;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%d", &a[i].f);
    scanf("%d", &a[i].s);
    a[i].id = i;
  }
  sort(a + 1, a + n + 1, comp);
  int ans = -1;
  int mx = -1, prev;
  for (long long i = 1; i <= n; i++) {
    if (i == 1) {
      prev = a[i].f;
      mx = a[i].s;
    } else if (i > 1 and i < n) {
      if (a[i].f >= prev and a[i].s <= mx) {
        cout << a[i].id << endl;
        return 0;
      }
      if (a[i].f >= prev and a[i].s <= a[i + 1].s and
          min(a[i].s, mx) + 1 >= a[i + 1].f and a[i].f <= mx) {
        cout << a[i].id << endl;
        return 0;
      }
      if (a[i].f > mx) {
        prev = a[i].f;
        mx = a[i].s;
        continue;
      } else {
        mx = max(mx, a[i].s);
      }
    } else if (i == n) {
      if (a[i].f >= a[i - 1].f and a[i].s <= a[i - 1].s) {
        cout << a[i].id << endl;
        return 0;
      }
    }
  }
  printf("%d\n", ans);
}
