#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const double EPS = 1e-9;
int mods(int a, int b) { return (b + (a % b)) % b; }
bool compare(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
  if (a.first == b.first) return a.second.first > b.second.first;
  return a.first < b.first;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b;
  vector<pair<int, pair<int, int> > > v;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    v.push_back(pair<int, pair<int, int> >(a, pair<int, int>(b, i)));
  }
  sort(v.begin(), v.end(), compare);
  int ans = v[0].second.second;
  for (int i = 1; i < v.size(); i++) {
    if (!(v[0].first <= v[i].first && v[i].second.first <= v[0].second.first)) {
      ans = -1;
      break;
    }
  }
  cout << ans << '\n';
  return 0;
}
