#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int MX = 2e5 + 7;
int n, l[MX], r[MX], cnt;
vector<pair<int, int> > vct;
map<int, int> nit, partial_summ;
int main() {
  while (cin >> n) {
    for (int i = 0; i < n; i++)
      l[i] = read(), r[i] = read(), vct.push_back({l[i], 1}),
      vct.push_back({r[i] + 1, -1});
    cnt = 0;
    sort(vct.begin(), vct.end());
    for (int i = 0; i < vct.size(); i++) {
      cnt += vct[i].second;
      nit[vct[i].first] = cnt;
    }
    int shonkha = 0;
    for (auto it = nit.begin(); it != nit.end(); it++) {
      partial_summ[it->first - 1] = shonkha;
      if (it->second == 1) shonkha++;
      partial_summ[it->first] = shonkha;
      auto it2 = it;
      it2++;
      if (it->second == 1 && it2 != nit.end())
        shonkha += (it2->first - it->first - 1);
    }
    int ans = -1;
    for (int i = 0; i < n; i++)
      if (partial_summ[r[i]] - partial_summ[l[i] - 1] == 0) {
        ans = i + 1;
        break;
      }
    cout << ans << endl;
    nit.clear();
    partial_summ.clear();
    vct.clear();
  }
  return 0;
}
