#include using namespace std; int main(){int N;cin>>N;vector>B(N);for(auto&[a,b]:B)cin>>a>>b;sort(B.begin(),B.end());for(auto[a,b]:B)cout<