while True:
try:
n = int(input())
l_n = []
while n:
n_n = input()
l_n.append(n_n)
n -= 1
ans = sorted(l_n)
for i in ans:
print(i)
except:
break
try:
n = int(input())
l_n = []
while n:
n_n = input()
l_n.append(n_n)
n -= 1
ans = sorted(l_n)
for i in ans:
print(i)
except:
break