#include <bits/stdc++.h>   using namespace std;   void swap(int &a, int &b) {     int temp = a;     a = b;     b = temp;   }   int main() {     int n;     cin >> n;     int x[n], y[n], min_x = INT_MAX, max_y = INT_MIN;     for (int i = 0; i < n; i++) {       cin >> x[i] >> y[i];       if (x[i] < min_x) min_x = x[i];       if (y[i] > max_y) max_y = y[i];     }     int k = 0, res = -1;     while (k < n) {       if (x[k] == min_x) {         if (y[k] == max_y) {           res = k + 1;           break;         }       }       k++;     }     cout << res << endl;   }   