n, l = list(map(int, input().split()))

s_list = []

for i in range(n):

    s_list.append(eval(input()))



# リストの各要素を空文字でjoin

s_str = ''.join(sorted(s_list))

print(s_str)
n, length = list(map(int, input().split()))

s_list = [eval(input()) for i in range(n)]



# リストの各要素を空文字でjoin

s_str = ''.join(sorted(s_list))

print(s_str)
n, l = list(map(int, input().split()))
s_list = []
for i in range(n):
    s_list.append(eval(input()))
# リストの各要素を空文字でjoin
s_str = "".join(sorted(s_list))
print(s_str)

n, length = list(map(int, input().split()))
s_list = [eval(input()) for i in range(n)]
# リストの各要素を空文字でjoin
s_str = "".join(sorted(s_list))
print(s_str)

-n, l = list(map(int, input().split())) -s_list = [] -for i in range(n): -    s_list.append(eval(input())) +n, length = list(map(int, input().split())) +s_list = [eval(input()) for i in range(n)]