#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100, M = 1e4 + 500;
const long double eps = 0.2, eps2 = 0.0001;
const int INF = (int)1e9 + 7, MOD = INF;
const long long LINF = 1e16;
const double PI = acos(-1.0);
int n;
map<int, int> num;
pair<int, int> m[N];
set<int> s;
int cnt[3 * N];
vector<pair<int, int> > scan;
int main() {
  ios::sync_with_stdio();
  cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> m[i].first >> m[i].second;
    m[i].first++, m[i].second++;
    num[m[i].first] = 0;
    num[m[i].first - 1] = 0;
    num[m[i].second] = 0;
  }
  int i = 0;
  for (auto it = num.begin(); it != num.end(); it++) {
    it->second = i++;
  }
  for (int i = 0; i < n; i++) {
    m[i].first = num[m[i].first];
    m[i].second = num[m[i].second];
    scan.push_back(make_pair(m[i].first, 1));
    scan.push_back(make_pair(m[i].second + 1, -1));
  }
  sort(scan.begin(), scan.end());
  i = 0;
  int bal = 0;
  for (int t = 0; t < 3 * N; t++) {
    while (i < scan.size() && scan[i].first <= t) {
      bal += scan[i].second;
      i++;
    }
    if (bal == 1) {
      cnt[t] = 1;
    }
  }
  for (int t = 0; t < 3 * N - 1; t++) {
    cnt[t + 1] += cnt[t];
  }
  for (int i = 0; i < n; i++) {
    if (cnt[m[i].second] == cnt[m[i].first - 1]) {
      cout << i + 1;
      return 0;
    }
  }
  cout << -1;
}
