#include<iostream>
#include<set>
using namespace std;
struct point{
int x,y;
bool operator <(const point &rhs) const{
if(x == rhs.x) return y < rhs.y;
else return x < rhs.x;
}
};
set<point> s;
int main()
{
int n;
cin>>n;
for(int i = 0;i < n;i ++){
point tmp;
cin>>tmp.x>>tmp.y;
s.insert(tmp);
}
for(set<point>::iterator it = s.begin();it != s.end();it ++){
cout<<it->x<<" "<<it->y<<endl;
/*
point x = *it;
cout<<x.x<<" "<<x.y<<endl;
*/
}
return 0;
}