#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  vector<pair<long long, long long> > v;
  long long l = 1e18, r = -1e18;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    l = min(l, a);
    r = max(r, b);
    v.push_back({a, b});
  }
  for (long long i = 0; i < v.size(); i++)
    if (v[i].first <= l and v[i].second >= r) {
      cout << i + 1;
      return 0;
    }
  cout << -1;
  return 0;
}
