#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
int main() {
  map<pair<int, int>, int> mp;
  vector<int> fast, last;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    fast.push_back(a);
    last.push_back(b);
    mp[{a, b}] = i + 1;
  }
  sort(fast.begin(), fast.end());
  sort(last.begin(), last.end());
  int one = fast[0], two = last[last.size() - 1];
  if (mp[{one, two}] == 0)
    cout << "-1" << endl;
  else
    cout << mp[{one, two}] << endl;
  return 0;
}
