#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pair<long, long> a[200000], b[200000];
  vector<pair<long, long> > p;
  long n;
  cin >> n;
  for (long long f = 0; f <= n - 1; ++f) {
    cin >> a[f].first >> a[f].second;
    b[f].first = a[f].first;
    b[f].second = a[f].second;
  }
  sort(&a[0], &a[n - 1] + 1);
  pair<long, long> now = make_pair(-1, -1);
  pair<long, long> one = a[0];
  for (long long f = 1; f <= n - 1; ++f) {
    if (now.first == -1) {
      if (a[f].first <= one.second) {
        now = make_pair(a[f].first, min(a[f].second, one.second));
      }
    } else {
      if (a[f].first <= one.second) {
        if (a[f].first <= now.second + 1) {
          now = make_pair(now.first,
                          max(now.second, min(a[f].second, one.second)));
        } else {
          p.push_back(now);
          now = make_pair(-1, -1);
          now = make_pair(a[f].first, min(a[f].second, one.second));
        }
      } else {
        p.push_back(now);
        now = make_pair(-1, -1);
      }
    }
    if (a[f].first <= one.second + 1) {
      one.second = max(one.second, a[f].second);
    } else {
      one = a[f];
    }
  }
  if (now.first != -1) {
    p.push_back(now);
  }
  if (p.size()) {
    for (long long f = 0; f <= n - 1; ++f) {
      long first = 0, second = p.size() - 1;
      while (first != second) {
        long m = ceil((double)(first + second) / 2);
        if (p[m] <= b[f]) {
          first = m;
        } else {
          second = m - 1;
        }
      }
      if (p[first].first <= b[f].first && b[f].second <= p[first].second) {
        cout << f + 1;
        return 0;
      }
    }
  }
  cout << -1;
  return 0;
}
