#include <bits/stdc++.h>
using namespace std;
const int TSIZE = 1 << 20;
int segtree[TSIZE * 2], prop[TSIZE * 2];
void seg_relax(int nod, int l, int r) {
  if (prop[nod] == 0) return;
  if (l < r) {
    segtree[nod << 1] += prop[nod];
    prop[nod << 1] += prop[nod];
    segtree[nod << 1 | 1] += prop[nod];
    prop[nod << 1 | 1] += prop[nod];
  }
  prop[nod] = 0;
}
int seg_query(int nod, int l, int r, int s, int e) {
  if (r < s || e < l) return 1e9;
  if (s <= l && r <= e) return segtree[nod] ? segtree[nod] : 1e9;
  seg_relax(nod, l, r);
  int m = (l + r) >> 1;
  return min(seg_query(nod << 1, l, m, s, e),
             seg_query(nod << 1 | 1, m + 1, r, s, e));
}
void seg_update(int nod, int l, int r, int s, int e) {
  if (r < s || e < l) return;
  if (s <= l && r <= e) {
    segtree[nod]++;
    prop[nod]++;
    return;
  }
  seg_relax(nod, l, r);
  int m = (l + r) >> 1;
  seg_update(nod << 1, l, m, s, e);
  seg_update(nod << 1 | 1, m + 1, r, s, e);
  segtree[nod] = min(segtree[nod << 1], segtree[nod << 1 | 1]);
}
vector<int> px;
map<int, int> pti;
int ll[200005], rr[200005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", ll + i, rr + i);
    px.push_back(ll[i] - 1);
    px.push_back(rr[i] + 1);
    px.push_back(ll[i]);
    px.push_back(rr[i]);
  }
  sort(px.begin(), px.end());
  px.erase(unique(px.begin(), px.end()), px.end());
  int m = px.size();
  for (int i = 0; i < m; i++) pti[px[i]] = i + 1;
  for (int i = 1; i <= n; i++) {
    ll[i] = pti[ll[i]];
    rr[i] = pti[rr[i]];
    seg_update(1, 1, m, ll[i], rr[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (seg_query(1, 1, m, ll[i], rr[i]) <= 1) continue;
    printf("%d\n", i);
    return 0;
  }
  puts("-1");
}
