#include <bits/stdc++.h>
using namespace std;
constexpr char eol = '\n';
struct Segment {
  int pos, index;
  bool is_begin;
  Segment() {}
  Segment(int p, int i, bool b) : pos(p), index(i), is_begin(b) {}
};
const int MAXN = 2e+5 + 10;
Segment segs[2 * MAXN];
int l[MAXN], r[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int q = 0; q < n; ++q) {
    cin >> l[q] >> r[q];
    ++r[q];
    segs[2 * q] = Segment(l[q], q, true);
    segs[2 * q + 1] = Segment(r[q], q, false);
  }
  stable_sort(segs, segs + 2 * n, [](const Segment &a, const Segment &b) {
    return a.pos != b.pos ? (a.pos < b.pos) : a.is_begin;
  });
  int cnt = 0, last_one = -1, c1 = -1, c2 = -1;
  for (int q = 0; q < 2 * n; ++q) {
    Segment &seg = segs[q];
    if (seg.is_begin) {
      ++cnt;
      if (cnt == 2) last_one = seg.pos;
    } else {
      --cnt;
      if (cnt != 0 or c1 == seg.pos) {
        int beg = l[seg.index];
        if (last_one <= beg and (c1 < beg or (c1 == seg.pos and c2 < beg))) {
          cout << seg.index + 1 << eol;
          return 0;
        }
      }
      if (cnt == 1) {
        c2 = c1;
        c1 = seg.pos;
      }
    }
  }
  cout << -1 << eol;
  return 0;
}
