n=int(input()) print(sorted([input().split() for i in range(n)]))