#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e6 + 5;
long long n, m, i, j, k = 0, cou = 0, F, x, y;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  long long min = MAX, max = -1;
  map<pair<long long, long long>, long long> mpp;
  pair<long long, long long> p;
  set<long long> s;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    s.insert(x);
    s.insert(y);
    p = make_pair(x, y);
    mpp[p] = (i + 1);
  }
  min = *min_element(s.begin(), s.end());
  max = *max_element(s.begin(), s.end());
  p = make_pair(min, max);
  if (mpp[p]) {
    cout << mpp[p];
  } else {
    cout << -1;
  }
  return 0;
}
