#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], b[n];
int an = 100000000000000000000021314231212344443232926;
bool found = false;
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
if (a[i] <= b[i]) {
an = min(an, b[i]);
found = true;
}
}
if (!found) cout << -1;
else cout << an;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: