#include <bits/stdc++.h>
using namespace std;
const double eps = 0.000000000000001;
int n;
pair<int, int> X[200010];
int poo[3 * 400010], mx;
vector<int> v;
int dp[3 * 400010][23], lg, l2[3 * 400010];
inline void pre() {
  int i, j;
  for (lg = 0; (1 << lg) <= mx; lg++)
    ;
  assert(lg < 23);
  for (i = 1; i <= mx; i++) {
    dp[i][0] = poo[i];
  }
  for (j = 1; j <= lg; j++) {
    for (i = 1; i <= mx; i++) {
      if (i + (1 << j) - 1 <= mx)
        dp[i][j] = min(dp[i][j - 1], dp[i + (1 << (j - 1))][j - 1]);
    }
  }
  l2[1] = 0;
  for (i = 2; i <= mx; i++) {
    l2[i] = l2[i >> 1] + 1;
  }
}
inline int que(int x, int y) {
  static int sz;
  sz = l2[y - x + 1];
  return min(dp[x][sz], dp[y - (1 << sz) + 1][sz]);
}
int main() {
  scanf("%d", &n);
  int i, j;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &X[i].first, &X[i].second);
    v.push_back(X[i].first - 1);
    v.push_back(X[i].first);
    v.push_back(X[i].first + 1);
    v.push_back(X[i].second - 1);
    v.push_back(X[i].second);
    v.push_back(X[i].second + 1);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  for (i = 1; i <= n; i++) {
    X[i].first = lower_bound(v.begin(), v.end(), X[i].first) - v.begin() + 1;
    X[i].second = lower_bound(v.begin(), v.end(), X[i].second) - v.begin() + 1;
    poo[X[i].first] += 1;
    poo[X[i].second + 1] -= 1;
    mx = max(mx, X[i].second);
  }
  assert(3 * 400010 > mx);
  for (i = 1; i < 3 * 400000 + 1; i++) {
    poo[i] += poo[i - 1];
  }
  pre();
  int ans = 0;
  for (i = 1; i <= n; i++) {
    int got = que(X[i].first, X[i].second);
    assert(got > 0);
    if (got > 1) {
      ans = i;
    }
  }
  printf("%d\n", (ans == 0 ? -1 : ans));
  return 0;
}
