#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
long long lcm(long long a, long long b) { return (a * b) / (gcd(a, b)); }
void solve() {
  long long n;
  cin >> n;
  long long mn = INT_MAX, mx = 0;
  vector<pair<long long, long long>> vec;
  for (long long i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    mn = min(mn, x);
    mx = max(mx, y);
    vec.push_back(make_pair(x, y));
  }
  long long count = 1;
  for (auto itr : vec) {
    if (itr.first <= mn && itr.second >= mx) {
      cout << count << "\n";
      return;
    }
    count++;
  }
  cout << "-1\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
}
