#include<iostream>
#include<algorithm>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	pair<int, int> vp[n];
	for (int i = 0; i < n; i++) {
		cin >> vp[i].first >> vp[i].second;
	}

	sort(vp, vp + n);

	for (int i = 0; i < n; i++) {
		cout << vp[i].first << " " << vp[i].second << endl;

	}
	return 0;
}
