#include <bits/stdc++.h>
using namespace std;
struct TV {
  int i;
  int l;
  int r;
};
struct Time {
  int l;
  int r;
  Time(int a, int b) : l(a), r(b) {}
};
struct Operation {
  int t;
  int op;
};
bool cmp_tv(const TV &a, const TV &b) {
  return a.l < b.l || (a.l == b.l && a.r > b.r);
}
bool cmp_ope(const Operation &a, const Operation &b) {
  return a.t < b.t || (a.t == b.t && a.op > b.op);
}
int main() {
  int n = 0;
  TV tv[200010];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &tv[i].l, &tv[i].r);
    tv[i].i = i + 1;
  }
  sort(tv, tv + n, cmp_tv);
  for (int i = 0; i < n - 1; i++) {
    if (tv[i + 1].l == tv[i].l || tv[i + 1].r <= tv[i].r) {
      printf("%d\n", tv[i + 1].i);
      return 0;
    }
  }
  Operation ope[400020];
  for (int i = 0; i < n; i++) {
    ope[i].t = tv[i].l;
    ope[i].op = 1;
    ope[n + i].t = tv[i].r;
    ope[n + i].op = -1;
  }
  sort(ope, ope + 2 * n, cmp_ope);
  int cnt = 0, start_time = -1;
  vector<Time> vec_t;
  for (int i = 0; i < 2 * n; i++) {
    cnt += ope[i].op;
    if (start_time < 0 && cnt > 1) {
      start_time = ope[i].t;
    } else if (start_time >= 0 && cnt <= 1) {
      Time tmp_time(start_time, ope[i].t);
      vec_t.push_back(tmp_time);
      start_time = -1;
    }
  }
  vector<Time> vec;
  for (unsigned int i = 0; i < vec_t.size();) {
    int start_time = vec_t[i].l;
    int end_time = vec_t[i].r;
    unsigned int j = 1;
    while (i + j < vec_t.size() && vec_t[i + j].l <= end_time + 1) {
      end_time = vec_t[i + j].r;
      j += 1;
    }
    Time tmp_time = Time(start_time, end_time);
    vec.push_back(tmp_time);
    i = i + j;
  }
  int v_pos = 0;
  for (int i = 0; i < n; i++) {
    while (v_pos < vec.size() && tv[i].l > vec[v_pos].r) {
      v_pos++;
    }
    if (v_pos >= vec.size()) {
      break;
    }
    if (tv[i].l >= vec[v_pos].l && tv[i].r <= vec[v_pos].r) {
      printf("%d\n", tv[i].i);
      return 0;
    }
  }
  printf("-1\n");
  return 0;
}
