#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> v;
  int len = -1, ind = 0;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    v.push_back(make_pair(x, y));
    if ((y - x) > len) {
      len = y - x;
      ind = i;
    }
  }
  for (int i = 0; i < n; i++) {
    if (v[i].first >= v[ind].first && v[i].second <= v[ind].second)
      continue;
    else {
      cout << "-1";
      return 0;
    }
  }
  cout << ind + 1;
}
