#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
bool r[MAXN];
int main() {
  int n;
  vector<pair<int, pair<int, int>>> v;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int l, r;
    cin >> l >> r;
    v.emplace_back(l, make_pair(1, i));
    v.emplace_back(r + 1, make_pair(0, i));
  }
  sort(v.begin(), v.end());
  set<int> s;
  for (int i = 0; i < v.size(); ++i) {
    while (i < v.size()) {
      if (v[i].second.first == 1) s.insert(v[i].second.second);
      if (v[i].second.first == 0) s.erase(s.find(v[i].second.second));
      if (v[i].first == v[i + 1].first)
        i++;
      else
        break;
    }
    if (s.size() == 1) r[*s.begin()] = 1;
  }
  for (int i = 0; i < n; ++i) {
    if (r[i] == 0) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
