#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
bool MinPlace(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool MaxPlace(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename S, typename T>
ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  for (int i = 0; i < (int)v.size(); i++) {
    out << v[i];
    if (i != (int)v.size() - 1) out << ", ";
  }
  out << "]";
  return out;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, l, r;
  cin >> n;
  vector<bool> useful(n + 1, false);
  vector<pair<int, pair<int, int>>> events;
  for (int i = 1; i <= n; i++) {
    cin >> l >> r;
    events.push_back(make_pair(l, make_pair(1, i)));
    events.push_back(make_pair(r + 1, make_pair(0, i)));
  }
  sort(events.begin(), events.end());
  unordered_set<int> open;
  for (int i = 0; i < events.size();) {
    int pos = events[i].first;
    while (i < events.size() and events[i].first == pos) {
      if (!events[i].second.first)
        open.erase(events[i].second.second);
      else
        open.insert(events[i].second.second);
      i++;
    }
    if (open.size() == 1) useful[*open.begin()] = true;
  }
  int out = -1;
  for (int i = 1; i <= n; i++)
    if (!useful[i]) {
      out = i;
      break;
    }
  cout << out << "\n";
}
