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

ls = []

for i in range(N):

    ls.append(eval(input()))

ls.sort()

ans = ""

for i in range(N):

    ans += ls[i]

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

ls = []

for i in range(N):

    ls.append(eval(input()))

ls.sort()

print(("".join(ls)))
N, L = list(map(int, input().split()))
ls = []
for i in range(N):
    ls.append(eval(input()))
ls.sort()
ans = ""
for i in range(N):
    ans += ls[i]
print(ans)

N, L = list(map(int, input().split()))
ls = []
for i in range(N):
    ls.append(eval(input()))
ls.sort()
print(("".join(ls)))

-ans = "" -for i in range(N): -    ans += ls[i] -print(ans) +print(("".join(ls)))