#include <bits/stdc++.h>
using namespace std;
const long long maxn = 6e5 + 54;
const long long mod = 1e9 + 7;
const long long base = 1e18;
long long x[maxn];
long long y[maxn];
long long st[4 * maxn];
long long la[4 * maxn];
struct tk {
  void dosth(long long id, long long left, long long right) {
    if (left != right) {
      st[id * 2] += la[id];
      st[id * 2 + 1] += la[id];
      la[id * 2] += la[id];
      la[id * 2 + 1] += la[id];
      la[id] = 0;
    }
  }
  long long get(long long id, long long left, long long right, long long x,
                long long y) {
    dosth(id, left, right);
    if (left > y || right < x) return 1e15;
    if (x <= left && right <= y) {
      return st[id];
    }
    long long mid = (left + right) / 2;
    return min(get(id * 2, left, mid, x, y),
               get(id * 2 + 1, mid + 1, right, x, y));
  }
  void update(long long id, long long left, long long right, long long x,
              long long y, long long diff) {
    dosth(id, left, right);
    if (x > right || y < left) return;
    if (x <= left && y >= right) {
      st[id] = (st[id] + diff);
      la[id] += diff;
      dosth(id, left, right);
      return;
    }
    long long mid = (left + right) / 2;
    update(id * 2, left, mid, x, y, diff);
    update(id * 2 + 1, mid + 1, right, x, y, diff);
    st[id] = min(st[id * 2], st[id * 2 + 1]);
  }
} man;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  if (fopen("p.inp", "r")) {
    freopen("test.inp", "r", stdin);
    freopen("test.out", "w", stdout);
  }
  vector<long long> vt;
  vt.push_back(-1e15);
  long long n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
    vt.push_back(x[i]);
    vt.push_back(x[i] - 1);
    vt.push_back(y[i]);
  }
  sort(vt.begin(), vt.end());
  vt.resize(unique(vt.begin(), vt.end()) - vt.begin());
  long long siz = vt.size();
  for (int i = 1; i <= n; i++) {
    long long h = lower_bound(vt.begin(), vt.end(), x[i]) - vt.begin();
    long long h1 = lower_bound(vt.begin(), vt.end(), y[i]) - vt.begin();
    man.update(1, 1, siz, h, h1, 1);
  }
  for (int i = 1; i <= n; i++) {
    long long h = lower_bound(vt.begin(), vt.end(), x[i]) - vt.begin();
    long long h1 = lower_bound(vt.begin(), vt.end(), y[i]) - vt.begin();
    if (man.get(1, 1, siz, h, h1) >= 2) {
      cout << i;
      return 0;
    }
  }
  cout << -1;
}
