#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
void tracer(istream_iterator<string> it) {}
template <typename T, typename... Args>
void tracer(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " | ";
  tracer(++it, args...);
}
const int INF = 2e9;
const long long LINF = 2e18;
const long long MOD = 1e9 + 7;
const double err = 1e-10;
const int N = 2e5 + 5;
void solve() {
  int n;
  cin >> n;
  vector<pair<int, int> > V(n);
  map<pair<int, int>, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> V[i].first >> V[i].second;
    mp[V[i]] = i;
  }
  sort((V).begin(), (V).end());
  int idx = 0, ans = -1;
  while (idx < n && ans == -1) {
    int rr = V[idx].second + 1;
    vector<int> cands;
    int tval = idx + 1;
    while (tval < n) {
      if (V[tval].first <= rr) {
        cands.push_back(tval);
        tval++;
      } else {
        break;
      }
    }
    if (((int)(cands).size()) > 1) {
      if (V[cands[0]].second >= V[cands[1]].second) {
        ans = mp[V[cands[1]]];
      } else {
        ans = mp[V[cands[0]]];
      }
    } else if (((int)(cands).size()) > 0) {
      if (V[cands[0]].first == V[idx].first) {
        ans = mp[V[idx]];
      } else if (V[cands[0]].second <= V[idx].second) {
        ans = mp[V[cands[0]]];
      } else {
        idx++;
      }
    } else {
      idx++;
    }
  }
  cout << (ans == -1 ? ans : ans + 1) << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int T = 1;
  for (int i = 1; i <= T; i++) {
    solve();
  }
  return 0;
}
