#include using namespace std; using ll=long long; using T=tuple; int main(){ ll n; cin>>n; vector v(n); for(ll i=0;i>x>>y; v[i]=T(x,y,i+1); } sort(v.begin(),v.end()); cout<(v[i])<<" "<(v[i+1])<