#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  vector<vector<long long> > a(n, vector<long long>(3));
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    a[i][2] = i + 1;
  }
  sort(a.begin(), a.end());
  for (int i = 1; i < n; i++) {
    if (a[i][1] <= a[i - 1][1]) {
      cout << a[i][2] << "\n";
      return;
    }
    if (a[i][0] <= a[i - 1][0]) {
      cout << a[i - 1][2] << "\n";
      return;
    }
    a[i][0] = max(a[i][0], a[i - 1][1] + 1);
  }
  cout << "-1\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
