#include <iostream>
#include <iostream>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <vector>
using namespace std;
struct point{
int x,y;
bool operator<(const point &o)
{ if(x!=o.x)
return x<o.x;
else
return y<o.y;
}
};
int main()
{
int a;
while(cin>>a)
{
vector<point> v(a);
for(point &s:v)
cin>>s.x>>s.y;
sort(v.begin(),v.end());
for(point s:v)
cout<<s.x<<" "<<s.y<<endl;
cout<<endl;
}
return 0;
}