#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 44;
struct Node {
  int li, ri;
} seg[M];
int n;
int sub1[M * 5], sub2[M * 5], lsub1, lsub2;
int s[M * 5], lmt;
int tree[M * 15], tag[M * 15], init_val[M * 15];
void build(int rt, int li, int ri) {
  tag[rt] = 0;
  if (li == ri) {
    tree[rt] = init_val[ri];
    return;
  }
  int mid = (li + ri) >> 1, lc = (rt << 1), rc = (rt << 1) + 1;
  build(lc, li, mid);
  build(rc, mid + 1, ri);
  tree[rt] = tree[lc] + tree[rc];
}
void pushdown(int rt, int li, int ri) {
  if (li == ri) {
    tag[rt] = 0;
    return;
  }
  int mid = (li + ri) >> 1, lc = (rt << 1), rc = (rt << 1) + 1;
  tree[lc] += tag[rt] * (mid - li + 1);
  tree[rc] += tag[rt] * (ri - (mid + 1) + 1);
  tag[lc] += tag[rt];
  tag[rc] += tag[rt];
  tag[rt] = 0;
}
int query(int rt, int li, int ri, int lq, int rq) {
  int ret = 0;
  if (lq <= li && ri <= rq) return tree[rt];
  int mid = (li + ri) >> 1, lc = (rt << 1), rc = (rt << 1) + 1;
  if (tag[rt]) pushdown(rt, li, ri);
  if (mid >= lq) ret += query(lc, li, mid, lq, rq);
  if (mid + 1 <= rq) ret += query(rc, mid + 1, ri, lq, rq);
  return ret;
}
void solve() {
  int i, j;
  memset(s, 0, sizeof(s));
  for (i = 1; i <= n; i++) {
    s[seg[i].ri + 1]--;
    s[seg[i].li]++;
  }
  for (i = 1; i <= lmt; i++) {
    s[i] += s[i - 1];
    if (s[i] >= 2)
      init_val[i] = 1;
    else
      init_val[i] = 0;
  }
  build(1, 1, lmt);
  for (i = 1; i <= n; i++)
    if (query(1, 1, lmt, seg[i].li, seg[i].ri) == seg[i].ri - seg[i].li + 1) {
      printf("%d\n", i);
      return;
    }
  printf("-1\n");
}
int main() {
  int i, j;
  scanf("%d", &n);
  lsub1 = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &seg[i].li, &seg[i].ri);
    sub1[lsub1++] = seg[i].li;
    sub1[lsub1++] = seg[i].ri;
  }
  sort(sub1, sub1 + lsub1);
  lsub2 = 1;
  sub2[0] = sub1[0];
  for (i = 1; i <= lsub1; i++) {
    if (sub1[i] > sub1[i - 1] + 1) sub2[lsub2++] = sub1[i] - 1;
    sub2[lsub2++] = sub1[i];
  }
  lsub2 = unique(sub2, sub2 + lsub2) - sub2;
  lmt = 0;
  for (i = 1; i <= n; i++) {
    seg[i].li = lower_bound(sub2, sub2 + lsub2, seg[i].li) - sub2 + 1;
    seg[i].ri = lower_bound(sub2, sub2 + lsub2, seg[i].ri) - sub2 + 1;
    lmt = max(lmt, seg[i].ri);
  }
  solve();
  return 0;
}
