#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;

int main() {

int n; cin >> n;
int x, y;

using P = pair<int,int>;
vector<P> v;
while(cin >> x >> y) {
  v.push_back({x, y});
}
std::sort(v.begin(), v.end());

for(auto& p : v) cout << p.first << " " << p.second << endl;
}

