#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 7;
int l[N], r[N];
int only[N], range[N];
int main() {
  int n;
  cin >> n;
  set<int> q;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    q.insert(l[i]);
    q.insert(r[i]);
    q.insert(l[i] - 1);
  }
  map<int, int> id;
  int cur = 0;
  for (auto x : q) id[x] = ++cur;
  for (int i = 1; i <= n; i++) {
    l[i] = id[l[i]];
    r[i] = id[r[i]];
    range[l[i]]++, range[r[i] + 1]--;
  }
  for (int i = 1; i < N; i++) range[i] += range[i - 1];
  for (int i = 1; i < N; i++) {
    only[i] = only[i - 1] + (range[i] == 1);
  }
  for (int i = 1; i <= n; i++) {
    if (only[r[i]] - only[l[i] - 1] == 0) {
      cout << i;
      exit(0);
    }
  }
  cout << -1;
  return 0;
}
