#include <bits/stdc++.h>
using namespace std;
int l[200100], r[200100];
bool cmp(int a, int b) {
  if (l[a] == l[b])
    return r[a] < r[b];
  else
    return l[a] < l[b];
}
int main() {
  int n, i, j, k;
  int h[200100];
  cin >> n;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    h[i] = i;
  }
  sort(h + 1, h + n + 1, cmp);
  for (i = 2; i <= n; i++) {
    if (l[h[i - 1]] == l[h[i]]) {
      cout << h[i - 1] << endl;
      return 0;
    }
    if (r[h[i - 1]] >= r[h[i]]) {
      cout << h[i] << endl;
      return 0;
    }
  }
  for (i = 2; i < n; i++) {
    if (r[h[i - 1]] + 1 >= l[h[i + 1]]) {
      cout << h[i] << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
