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