#include <bits/stdc++.h>
using namespace std;
const int N = 400100;
struct node {
  int l, r;
} ev[N];
vector<int> compx;
int acc[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    compx.push_back(a);
    compx.push_back(b);
    ev[i].l = a;
    ev[i].r = b;
  }
  sort(compx.begin(), compx.end());
  compx.erase(unique(compx.begin(), compx.end()), compx.end());
  for (int i = 0; i < n; i++) {
    int l = lower_bound(compx.begin(), compx.end(), ev[i].l) - compx.begin();
    int r = lower_bound(compx.begin(), compx.end(), ev[i].r) - compx.begin();
    acc[l]++;
    acc[r]--;
  }
  for (int i = 0; i < compx.size(); i++) {
    acc[i + 1] += acc[i];
  }
  vector<int> sum(compx.size() + 1);
  for (int i = 0; i < compx.size(); i++) {
    sum[i + 1] = sum[i] + (acc[i] >= 2);
  }
  int ans = -1;
  for (int i = 0; i < n; i++) {
    int l = lower_bound(compx.begin(), compx.end(), ev[i].l) - compx.begin();
    int r = lower_bound(compx.begin(), compx.end(), ev[i].r) - compx.begin();
    if (sum[r] - sum[l] == r - l) {
      ans = i;
    }
  }
  printf("%d\n", ans == -1 ? ans : ans + 1);
}
