#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<int> vct;
int nit[8 * MX], partial_summ[8 * MX];
int main() {
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      l[i] = read(), r[i] = read();
      vct.push_back(l[i]);
      vct.push_back(r[i]);
      vct.push_back(r[i] + 1);
      vct.push_back(l[i] - 1);
    }
    cnt = 0;
    sort(vct.begin(), vct.end());
    vct.resize(unique(vct.begin(), vct.end()) - vct.begin());
    for (int i = 0; i < n; i++) {
      int indx = lower_bound(vct.begin(), vct.end(), l[i]) - vct.begin();
      l[i] = indx;
      nit[indx]++;
      indx = lower_bound(vct.begin(), vct.end(), r[i] + 1) - vct.begin();
      r[i] = indx - 1;
      nit[indx]--;
    }
    for (int i = 1; i < vct.size(); i++) nit[i] += nit[i - 1];
    int shonkha = 0;
    for (int i = 0; i < vct.size(); i++) {
      if (nit[i] == 1) shonkha++;
      partial_summ[i] = shonkha;
      if (nit[i] == 1 && i + 1 < vct.size())
        shonkha += (vct[i + 1] - vct[i] - 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;
    memset(nit, 0, sizeof(nit));
    memset(partial_summ, 0, sizeof(partial_summ));
    vct.clear();
  }
  return 0;
}
