#include<bits/stdc++.h>
#define ll long long 
#define ull unsigned long long
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define repr(i,n) for (int i = n; i >= 0; --i)
#define P pair<int, int>
#define ALL(x) (x).begin(),(x).end()
const int INF = 1e9;
using namespace std;

int main() {
	vector<P>v;
	int n;
	cin >> n;
	rep(i,n) {
		int x,y;
		cin >> x >> y;
		v.push_back(P(x,y));
	}
	sort(ALL(v));
	rep(i,v.size()) cout << v[i].first << ' ' << v[i].second << endl;
}
