#include <bits/stdc++.h>
using namespace std;
const int mx = 2e5 + 10;
vector<tuple<int, int, int> > q;
bool red[mx];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    q.push_back(make_tuple(l, 1, i));
    q.push_back(make_tuple(r, 3, i));
    for (int it = -1; it <= 1; it++) q.push_back(make_tuple(l + it, 2, -1));
    for (int it = -1; it <= 1; it++) q.push_back(make_tuple(r + it, 2, -1));
  }
  sort(q.begin(), q.end());
  set<int> o;
  memset(red, true, sizeof red);
  for (int it = 0; it < int(q.size()); it++) {
    int x, t, i;
    tie(x, t, i) = q[it];
    if (t == 1)
      o.insert(i);
    else if (t == 3)
      o.erase(i);
    else {
      if (o.size() == 1) red[*o.begin()] = false;
    }
  }
  for (int i = 0; i < n; i++)
    if (red[i]) {
      printf("%d\n", i + 1);
      return 0;
    }
  puts("-1");
  return 0;
}
