#include <bits/stdc++.h>

using namespace std;

#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define rep(i, n) reps(i, 0, (n))
#define all(v) (v).begin(), (v).end()

int main() {
    int n; cin >> n;
    vector<pair<int, int>> v;
    rep(i, n) {
        int a, b; cin >> a >> b;
        v.emplace_back(a, b);
    }
    sort(all(v));
    rep(i, n) {
        cout << v[i].first << " " << v[i].second << endl;
    }
}

