import sys
readline = sys.stdin.readline
N = int(readline())
C = []
for _ in range(N):
    C.append(list(map(int, readline().split())))
C.sort()
for i in range(N):
    print(*C[i])

cfd6be00213b6857b1dbb1d1e1b099516837f1eb
<mask token>

<mask token>
for _ in range(N):
    C.append(list(map(int, readline().split())))
C.sort()
for i in range(N):
    print(*C[i])

<mask token>
readline = sys.stdin.readline
N = int(readline())
C = []
for _ in range(N):
    C.append(list(map(int, readline().split())))
C.sort()
for i in range(N):
    print(*C[i])

import sys
readline = sys.stdin.readline
N = int(readline())
C = []
for _ in range(N):
    C.append(list(map(int, readline().split())))
C.sort()
for i in range(N):
    print(*C[i])
