#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<long long int> v;
  long long int maxi = 1, mini = 10000000000;
  for (int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    mini = min(mini, a);
    maxi = max(maxi, b);
    v.push_back(a);
    v.push_back(b);
  }
  int flag = 3;
  for (int i = 0; i < v.size(); i += 2) {
    if (v[i] <= mini && v[i + 1] >= maxi) {
      cout << (i + 2) / 2 << endl;
      flag = 2;
      break;
    }
  }
  if (flag == 3) {
    cout << "-1" << endl;
  }
}
