#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;

    vector<pair<int, int>> vt;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        vt.emplace_back(make_pair(x, y));
    }

    sort(vt.begin(), vt.end());
    for (auto x:vt) {
        cout << x.first << " " << x.second << endl;
    }
    return 0;
}
