#include <bits/stdc++.h>
using namespace std;
int n;
bool needed[200001];
map<long long, pair<vector<long long>, vector<long long>>> tv;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long l, r;
    scanf("%lld %lld", &l, &r);
    tv[l].first.push_back(i);
    tv[r + 1].second.push_back(i);
  }
  unordered_set<long long> active;
  for (auto &a : tv) {
    active.insert(a.second.first.begin(), a.second.first.end());
    for (int x : a.second.second) active.erase(x);
    if (active.size() == 1) needed[*active.begin()] = true;
  }
  for (int i = 1; i <= n; i++)
    if (!needed[i]) return printf("%d", i), 0;
  return printf("-1"), 0;
}
