#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, l[N], r[N], cnt[4 * N], one[4 * N];
vector<int> g;
map<int, int> mp;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> l[i] >> r[i];
    g.push_back(l[i] - 1);
    g.push_back(l[i]);
    g.push_back(r[i]);
    g.push_back(r[i] + 1);
  }
  sort(g.begin(), g.end());
  for (int i = 0, cnt = 0; i < g.size(); ++i) {
    if (!i || g[i] != g[i - 1]) cnt++;
    mp[g[i]] = cnt;
  }
  for (int i = 1; i <= n; ++i) {
    cnt[mp[l[i]]]++;
    cnt[mp[r[i] + 1]]--;
  }
  for (int i = 1; i <= 4 * n; ++i) {
    cnt[i] += cnt[i - 1];
    if (cnt[i] == 1) {
      one[i] = 1;
    }
    one[i] += one[i - 1];
  }
  for (int i = 1; i <= n; ++i) {
    if (one[mp[r[i]]] == one[mp[l[i] - 1]]) {
      cout << i << '\n';
      return 0;
    }
  }
  cout << "-1\n";
}
