#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, l[N], r[N], up = 1e9 + 1;
int Min[N * 60], lazy[N * 60], lson[N * 60], rson[N * 60], rt = 1, cnt = 1;
inline void push_up(int p) { Min[p] = min(Min[lson[p]], Min[rson[p]]); }
inline void push_down(int rt) {
  if (!lazy[rt]) return;
  lazy[lson[rt]] += lazy[rt], lazy[rson[rt]] += lazy[rt];
  Min[lson[rt]] += lazy[rt], Min[rson[rt]] += lazy[rt];
  lazy[rt] = 0;
}
void update(int rt, int l, int r, int L, int R, int v) {
  if (L <= l && r <= R) {
    lazy[rt] += v;
    Min[rt] += v;
    return;
  }
  if (!lson[rt]) lson[rt] = ++cnt;
  if (!rson[rt]) rson[rt] = ++cnt;
  int mid = l + r >> 1;
  push_down(rt);
  if (L <= mid) update(lson[rt], l, mid, L, R, v);
  if (mid < R) update(rson[rt], mid + 1, r, L, R, v);
  push_up(rt);
}
int query(int rt, int l, int r, int L, int R) {
  if (L <= l && r <= R) return Min[rt];
  if (!lson[rt]) lson[rt] = ++cnt;
  if (!rson[rt]) rson[rt] = ++cnt;
  int mid = l + r >> 1;
  push_down(rt);
  int ans = 1e9 + 10;
  if (L <= mid) ans = min(ans, query(lson[rt], l, mid, L, R));
  if (mid < R) ans = min(ans, query(rson[rt], mid + 1, r, L, R));
  return ans;
}
signed main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    update(rt, 1, up, l[i] + 1, r[i] + 1, 1);
  }
  for (int i = 1; i <= n; i++)
    if (query(rt, 1, up, l[i] + 1, r[i] + 1) >= 2) return cout << i, 0;
  puts("-1");
  return 0;
}
