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



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



S = sorted(S)

ans = ""



for i in S:

  ans += i

  

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

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

S.sort()

ans = ""

for s in S:

  ans += s

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

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

-S = sorted(S) +S.sort() -for i in S: -    ans += i +for s in S: +    ans += s