#include <bits/stdc++.h>
using namespace std;
bool debug = 1;
long long MOD = 1e9 + 7;
const int N = 2e5 + 10;
map<int, vector<int>> mpe, mps;
int nonred[N];
int n;
set<int> st;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    mpe[l].push_back(i + 1);
    mps[r + 1].push_back(i + 1);
    st.insert(l);
    st.insert(r + 1);
  }
  set<int> at;
  for (auto &tempo : st) {
    for (auto &it : mpe[tempo]) {
      at.insert(it);
    }
    for (auto &it : mps[tempo]) {
      if (!nonred[it]) {
        cout << it << endl;
        return 0;
      }
      at.erase(it);
    }
    if (at.size() == 1) {
      nonred[*at.begin()] = 1;
    }
  }
  cout << -1 << endl;
  return 0;
}
