N, L = list(map(int, input().split()))

Ss = [input() for i in range(N)]



sort_Ss = sorted(Ss)

joined_Ss = ''.join(sort_Ss)



print(joined_Ss)

N, L = list(map(int, input().split()))

words = [eval(input()) for _ in range(N)]

words.sort()

ans = ''.join(words)

print(ans)
N, L = list(map(int, input().split()))
Ss = [input() for i in range(N)]
sort_Ss = sorted(Ss)
joined_Ss = "".join(sort_Ss)
print(joined_Ss)

N, L = list(map(int, input().split()))
words = [eval(input()) for _ in range(N)]
words.sort()
ans = "".join(words)
print(ans)

-Ss = [input() for i in range(N)] -sort_Ss = sorted(Ss) -joined_Ss = "".join(sort_Ss) -print(joined_Ss) +words = [eval(input()) for _ in range(N)] +words.sort() +ans = "".join(words) +print(ans)