#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
const int N = 1000005;
vector<int> ve;
int n, l[N], r[N], il[N], ir[N];
int sum[N], pre[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &l[i], &r[i]);
    ve.push_back(l[i]);
    ve.push_back(r[i]);
    ve.push_back(l[i] - 1);
    ve.push_back(r[i] + 1);
  }
  sort(ve.begin(), ve.end());
  ve.erase(unique(ve.begin(), ve.end()), ve.end());
  int sz = ve.size();
  for (int i = 1; i <= n; ++i) {
    il[i] = lower_bound(ve.begin(), ve.end(), l[i]) - ve.begin() + 1;
    ir[i] = lower_bound(ve.begin(), ve.end(), r[i]) - ve.begin() + 1;
    ++sum[il[i]];
    --sum[ir[i] + 1];
  }
  for (int i = 1; i <= sz; ++i) {
    sum[i] += sum[i - 1];
    pre[i] = pre[i - 1] + (sum[i] == 1);
  }
  for (int i = 1; i <= n; ++i)
    if (pre[ir[i]] - pre[il[i] - 1] == 0) {
      return 0 * printf("%d\n", i);
    }
  puts("-1");
  return 0;
}
