#include<iostream>
#include<map>
using namespace std;
struct node{
int d,t;
bool operator<(const node &o) const{
if(d != o.d) return d < o.d;
return t < o.t;
}
};
map<node,int> mp;
int n;
int main(){
cin >> n;
while(n--){
int x,y;
cin >> x >> y;
if(mp.count({x,y})) mp[{x,y}]++;
else mp[{x,y}] = 1;
}
for(auto &it : mp){
while(it.second--) cout << it.first.d << " " << it.first.t << endl;
}
return 0;
}