#include <bits/stdc++.h>
using namespace std;
const long long int M = 1e9 + 7;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<pair<pair<int, int>, int>> ok;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    ok.push_back({{l, r}, i + 1});
  }
  sort((ok).begin(), (ok).end());
  int curl = ok[0].first.first;
  int curr = ok[0].first.second;
  int previ = ok[0].second;
  int ans = -1;
  for (int i = 1; i < n; i++) {
    if (ok[i].first.first > curl) {
      if (ok[i].first.second <= curr) {
        ans = ok[i].second;
        break;
      } else {
        curl = max(curr + 1, ok[i].first.first);
        curr = ok[i].first.second;
        previ = ok[i].second;
      }
    } else {
      if (ok[i].first.second > curr) {
        ans = previ;
        break;
      } else {
        ans = ok[i].second;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
