#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<pair<ll, ll> > ps;
  for(int i = 0; i < n; ++i) {
    ll x, y;
    cin >> x >> y;
    ps.emplace_back(x, y);
  }
  sort(ps.begin(), ps.end());
  for(auto p : ps) cout << p.first << " " << p.second << endl;
  return 0;
}

