#include <bits/stdc++.h>
using namespace std;
const int N = 200000;
pair<int, bool> p[N * 2];
pair<int, int> t[N];
int main() {
  int n;
  scanf("%d", &n);
  int l, r;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &l, &r);
    t[i] = make_pair(l, r);
    p[i * 2].first = l;
    p[i * 2].second = false;
    p[i * 2 + 1].first = r + 1;
    p[i * 2 + 1].second = true;
  }
  sort(p, p + n * 2);
  int current = 0;
  vector<int> v;
  for (int i = 0; i < n * 2; ++i) {
    if (!p[i].second)
      ++current;
    else
      --current;
    if ((i == n * 2 - 1 || p[i + 1].first != p[i].first) && current == 1)
      v.push_back(p[i].first);
  }
  for (int i = 0; i < n; ++i) {
    int it = lower_bound(v.begin(), v.end(), t[i].first) - v.begin();
    if (it == v.size() || (v[it] > t[i].second)) {
      printf("%d\n", i + 1);
      return 0;
    }
  }
  printf("-1\n");
  return 0;
}
