#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c *x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug &operator<<(const c &) {
    return *this;
  }
};
using ll = long long;
const int inf = 1e9 + 5;
const ll INF = 1e18 + 5;
const int nax = 2e5 + 500;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<array<int, 3>> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    a[i][2] = i + 1;
  }
  sort(a.begin(), a.end(), [&](const array<int, 3> &x, const array<int, 3> &y) {
    if (x[1] == y[1]) return x[0] < y[0];
    return x[1] > y[1];
  });
  array<int, 2> take = {a[0][0], a[0][1]};
  for (int i = 1; i < n; i++) {
    if (a[i][0] < take[0] || a[i][1] > take[1]) {
      cout << -1;
      return 0;
    }
  }
  cout << a[0][2];
}
