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

a = [eval(input()) for i in range(N)]

a.sort()

b = ""

for i in range(N):

 b += a[i]

print(b)

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

S = []

for i in range(N):

	S.append(eval(input()))

S.sort()

S.reverse()

ans = ""

for i in range(N):

	ans += S.pop()

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

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

-a = [eval(input()) for i in range(N)] -a.sort() -b = "" +S = [] -    b += a[i] -print(b) +    S.append(eval(input())) +S.sort() +S.reverse() +ans = "" +for i in range(N): +    ans += S.pop() +print(ans)