#include <bits/stdc++.h>
using namespace std;
void sprint(string s) {
  for (int i = 0; i < (int)s.size(); ++i) printf("%c", s[i]);
  printf("\n");
}
int main() {
  int n;
  cin >> n;
  pair<int, int> a[n];
  vector<pair<pair<int, int>, int> > v;
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[i] = {x, y};
    v.emplace_back(make_pair(make_pair(x, 1), i));
    v.emplace_back(make_pair(make_pair(y + 1, -1), i));
  }
  sort(v.begin(), v.end());
  int curr = 0;
  int prev = -1;
  for (int i = 0; i < 2 * n; ++i) {
    if (v[i].first.second == 1)
      curr++;
    else
      curr--;
    if (v[i].first.second == -1) {
      int id = v[i].second;
      if (prev < a[id].first) {
        printf("%d\n", id + 1);
        return 0;
      }
    }
    if (i < 2 * n - 1 and v[i + 1].first.first > v[i].first.first and curr == 1)
      prev = v[i].first.first;
  }
  printf("-1\n");
  return 0;
}
