#include <bits/stdc++.h>
using namespace std;
bool mycomp(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
  if (a.second.first < b.second.first)
    return true;
  else
    return false;
}
int main() {
  int n;
  cin >> n;
  pair<int, pair<int, int> > arr[n];
  int mini = 0, maxi = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].second.first >> arr[i].second.second;
    arr[i].first = i + 1;
  }
  sort(arr, arr + n, mycomp);
  int min = arr[0].second.first;
  int i = 1;
  int ans = arr[0].first;
  int max = arr[0].second.second;
  while (arr[i].second.first == min) {
    if (arr[i].second.second > max) {
      max = arr[i].second.second;
      ans = arr[i].first;
    }
    i++;
  }
  while (i < n) {
    if (arr[i].second.second > max) {
      ans = -1;
      max = arr[i].second.second;
      break;
    }
    i++;
  }
  cout << ans;
}
