#include <bits/stdc++.h>
using namespace std;
map<int, int> t;
map<int, int> p;
void send(int x, int lo, int hi) {
  if (p[x] == 0) return;
  t[x] = t[x] + p[x];
  if ((2 * x + 1) <= (4 * 1e9 + 1)) {
    p[x * 2] = p[2 * x] + p[x];
    p[x * 2 + 1] = p[2 * x + 1] + p[x];
  }
  p[x] = 0;
}
void update(int x, int lo, int hi, int l, int r, int v) {
  send(x, lo, hi);
  if (lo > r or hi < l) return;
  if (lo >= l && hi <= r) {
    p[x] = p[x] + v;
    send(x, lo, hi);
    return;
  }
  update(x * 2, lo, (lo + hi) / 2, l, r, v);
  update(x * 2 + 1, (lo + hi) / 2 + 1, hi, l, r, v);
  t[x] = min(t[x * 2], t[x * 2 + 1]);
}
int query(int x, int lo, int hi, int l, int r) {
  send(x, lo, hi);
  if (lo > r or hi < l) return 1e9;
  if (lo >= l && hi <= r) return t[x];
  return min(query(x * 2, lo, (lo + hi) / 2, l, r),
             query(x * 2 + 1, (lo + hi) / 2 + 1, hi, l, r));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  if (n >= 2000) {
    vector<tuple<int, int, int>> v;
    int maxi1[n];
    for (int i = 0; i < n; i++) {
      int l, r;
      cin >> l >> r;
      maxi1[i] = -1;
      v.push_back({l, r, i});
    }
    sort(v.begin(), v.end());
    for (int i = n - 1; i >= 0; i--) {
      if (i == (n - 1)) {
        maxi1[i] = get<1>(v[i]);
      } else {
        maxi1[i] = max(maxi1[i + 1], get<1>(v[i]));
      }
    }
    int maxi = -1;
    if (n == 1) {
      cout << -1;
      return 0;
    }
    for (int i = 0; i < v.size(); i++) {
      if (i == 0) {
        if (get<0>(v[i + 1]) == get<0>(v[i])) {
          cout << get<2>(v[i]) + 1;
          return 0;
        }
        maxi = get<1>(v[i]);
      } else if (i == (v.size() - 1)) {
        if (maxi >= get<1>(v[i])) {
          cout << get<2>(v[i]) + 1;
          return 0;
        }
      } else {
        if (maxi >= (get<1>(v[i])) or get<0>(v[i + 1]) == get<0>(v[i])) {
          cout << get<2>(v[i]) + 1;
          return 0;
        } else {
          if (maxi >= (get<0>(v[i + 1]) - 1) and maxi1[i + 1] >= get<1>(v[i])) {
            cout << get<2>(v[i]) + 1;
            return 0;
          }
        }
      }
      if (get<1>(v[i]) > maxi) {
        maxi = get<1>(v[i]);
      }
    }
    cout << -1;
  } else {
    vector<tuple<int, int, int>> v;
    int maxi1[n];
    int l[n];
    int r[n];
    for (int i = 0; i < n; i++) {
      cin >> l[i] >> r[i];
      maxi1[i] = -1;
      update(1, 0, 1e9 + 1, l[i], r[i], 1);
    }
    for (int i = 0; i < n; i++) {
      update(1, 0, 1e9 + 1, l[i], r[i], -1);
      if (query(1, 0, 1e9 + 1, l[i], r[i]) > 0) {
        cout << i + 1;
        return 0;
      }
      update(1, 0, 1e9 + 1, l[i], r[i], 1);
    }
    cout << -1;
  }
}
