#include <bits/stdc++.h>
using namespace std;
int l[200500];
int r[200500];
vector<int> love;
vector<int> hate;
const int maxtime = 1000000;
vector<int> in[maxtime];
vector<int> out[maxtime];
set<int> now;
char res[200500];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i];
    cin >> r[i];
    love.push_back(l[i]);
    love.push_back(r[i]);
  }
  sort(love.begin(), love.end());
  hate.push_back(0);
  for (int i = 1; i < love.size(); i++) {
    int diff = love[i] - love[i - 1];
    if (!diff) {
      hate.push_back(hate.back());
    } else if (diff == 1) {
      hate.push_back(hate.back() + 1);
    } else {
      hate.push_back(hate.back() + 2);
    }
  }
  for (int i = 0; i < n; i++) {
    l[i] = hate[lower_bound(love.begin(), love.end(), l[i]) - love.begin()];
    r[i] = hate[lower_bound(love.begin(), love.end(), r[i]) - love.begin()];
    in[l[i]].push_back(i);
    out[r[i] + 1].push_back(i);
  }
  for (int i = 0; i < maxtime; i++) {
    for (auto x : in[i]) {
      now.insert(x);
    }
    for (auto x : out[i]) {
      now.erase(x);
    }
    if (now.size() == 1) {
      res[*(now.begin())] = 6;
    }
  }
  for (int i = 0; i < n; i++) {
    if (!res[i]) {
      cout << 1 + i;
      return 0;
    }
  }
  cout << -1;
  return 0;
}
