#include <bits/stdc++.h>
using namespace std;
class Normalization {
 private:
  unordered_map<int, int> umap;

 public:
  Normalization(vector<int> arr) {
    sort(arr.begin(), arr.end());
    arr.erase(unique(arr.begin(), arr.end()), arr.end());
    int v = 0;
    for (int x : arr) umap[x] = ++v;
  }
  int operator[](int key) const {
    auto it = umap.find(key);
    assert(it != umap.end());
    return it->second;
  }
  int size() const { return (int)umap.size(); }
};
int main() {
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  using Interval = tuple<int, int, int>;
  vector<Interval> intervals(N);
  vector<int> v;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    l++;
    r++;
    v.push_back(l);
    v.push_back(r);
    v.push_back(l - 1);
    v.push_back(r + 1);
    intervals[i] = make_tuple(l, r, i);
  }
  Normalization norm(v);
  vector<int> prefix(norm.size() + 2);
  for (int i = 0; i < N; i++) {
    int l, r, id;
    tie(l, r, id) = intervals[i];
    intervals[i] = make_tuple(norm[l], norm[r], id);
    tie(l, r, std::ignore) = intervals[i];
    prefix[l]++;
    prefix[r + 1]--;
  }
  partial_sum(prefix.begin(), prefix.end(), prefix.begin());
  vector<int> cnt;
  partial_sum(prefix.begin(), prefix.end(), back_inserter(cnt),
              [](int acc, int x) { return acc + (x == 1); });
  for (int i = 0; i < N; i++) {
    int l, r, id;
    tie(l, r, id) = intervals[i];
    if (cnt[r] - cnt[l - 1] == 0) {
      cout << id + 1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
