#include <bits/stdc++.h>
using namespace std;
void fre() {
  freopen("c://test//input.in", "r", stdin);
  freopen("c://test//output.out", "w", stdout);
}
template <class T1, class T2>
inline void gmax(T1 &a, T2 b) {
  if (b > a) a = b;
}
template <class T1, class T2>
inline void gmin(T1 &a, T2 b) {
  if (b < a) a = b;
}
const int N = 2e5 + 10, M = 0, Z = 1e9 + 7, inf = 0x3f3f3f3f;
template <class T1, class T2>
inline void gadd(T1 &a, T2 b) {
  a = (a + b) % Z;
}
int casenum, casei;
int n;
map<int, vector<int>> mop;
set<int> now;
bool e[N];
int main() {
  while (~scanf("%d", &n)) {
    mop.clear();
    now.clear();
    memset(e, 0, sizeof(e));
    int g = 0;
    for (int i = 1; i <= n; ++i) {
      int L, R;
      scanf("%d%d", &L, &R);
      mop[L].push_back(i);
      mop[R + 1].push_back(-i);
    }
    int sum = 0;
    for (auto it : mop) {
      for (auto x : it.second) {
        if (x > 0) {
          now.insert(x);
          ++sum;
        } else {
          now.erase(-x);
          --sum;
        }
      }
      if (sum == 1) {
        e[*now.begin()] = 1;
      }
    }
    int ans = -1;
    for (int i = 1; i <= n; ++i) {
      if (e[i] == 0) {
        ans = i;
        break;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
