#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){

  int n;
  vector <pair<int,int>> a;
  cin>>n;
  for(int i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    a.push_back(make_pair(x,y));
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++) cout<<a[i].first<<" "<<a[i].second<<endl;
  return 0;


}

