#include <bits/stdc++.h>
using namespace std;
const int SIZE = 200001;
const int INF = 987654321;
vector<pair<int, int> > arr;
vector<pair<int, int> > v;
int rangeMin[16 * SIZE];
int min(int a, int b) { return a < b ? a : b; }
int init(int node, int left, int right) {
  if (left == right) return rangeMin[node] = arr[left].second;
  int mid = (left + right) / 2;
  int l = init(2 * node, left, mid);
  int r = init(2 * node + 1, mid + 1, right);
  return rangeMin[node] = min(l, r);
}
int query(int node, int left, int right, int nodeLeft, int nodeRight) {
  if (right < nodeLeft || nodeRight < left) return INF;
  if (left <= nodeLeft && nodeRight <= right) return rangeMin[node];
  int nodeMid = (nodeLeft + nodeRight) / 2;
  int l = query(2 * node, left, right, nodeLeft, nodeMid);
  int r = query(2 * node + 1, left, right, nodeMid + 1, nodeRight);
  return min(l, r);
}
int search(int x) {
  int mid, l = 0, r = arr.size() - 1;
  while (1) {
    mid = (l + r) / 2;
    if (arr[mid].first == x) return mid;
    if (arr[mid].first < x)
      l = mid + 1;
    else
      r = mid;
  }
}
int main() {
  int n, l[200001], r[200001];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &l[i], &r[i]);
    v.push_back(make_pair(l[i] - 1, 0));
    v.push_back(make_pair(l[i], 1));
    v.push_back(make_pair(r[i], 0));
    v.push_back(make_pair(r[i] + 1, -1));
  }
  sort(v.begin(), v.end());
  arr.push_back(v[0]);
  for (int i = 1; i < v.size(); i++) {
    int last = arr.size() - 1;
    if (v[i].first == v[i - 1].first)
      arr[last].second += v[i].second;
    else
      arr.push_back(make_pair(v[i].first, arr[last].second + v[i].second));
  }
  int N = arr.size();
  init(1, 0, N - 1);
  for (int i = 0; i < n; i++) {
    if (query(1, search(l[i]), search(r[i]), 0, N - 1) >= 2) {
      printf("%d\n", i + 1);
      return 0;
    }
  }
  printf("-1\n");
}
