#include <bits/stdc++.h>
const long long MAX = 1000000000000000000;
using namespace std;
void solve(long long n = 0, vector<long long> primos = {}) {
  int l = 1000000001, r = 0, a, b, res = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a <= l and b >= r) {
      res = i + 1;
      l = a;
      r = b;
    } else if (b > r) {
      r = b;
      res = -1;
    } else if (a < l) {
      l = a;
      res = -1;
    }
  }
  cout << res << endl;
}
int32_t main() {
  int n;
  solve();
}
