#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1e5;
const long long mod = 1e9;
const long long MOD = 998244353;
const long double eps = 0.000000001;
const int P = 1336;
const int inf = 1e9 + 7;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
int v1[N], v2[N];
bool comp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.first == b.first.first) return a.first.second > b.first.second;
  return a.first.first < b.first.first;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand(time(0));
  int n;
  cin >> n;
  vector<pair<pair<int, int>, int> > a;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first.first >> a[i].first.second;
    a[i].second = i;
  }
  sort(a.begin(), a.end(), comp);
  set<int> st;
  st.insert(inf);
  for (auto to : a) {
    int p = *st.lower_bound(to.first.second);
    if (p != inf) {
      cout << to.second + 1;
      return 0;
    }
    st.insert(to.first.second);
  }
  st.clear();
  st.insert(-inf);
  for (auto to : a) {
    int p = *st.lower_bound(-to.first.second);
    p = -p;
    v1[to.second] = p;
    st.insert(-to.first.second);
  }
  for (int i = 0; i < a.size(); i++) {
    swap(a[i].first.first, a[i].first.second);
  }
  sort(a.rbegin(), a.rend());
  st.clear();
  st.insert(inf);
  for (auto to : a) {
    int p = *st.lower_bound(to.first.second);
    v2[to.second] = p;
    st.insert(to.first.second);
  }
  for (int i = 0; i < n; i++) {
    if (v1[i] == inf || v2[i] == inf) continue;
    if (v1[i] + 1 >= v2[i]) {
      cout << i + 1;
      return 0;
    }
  }
  cout << -1;
}
