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



s = []

for _ in range(n):

    s.append(eval(input()))



s.sort()



ans =''.join(s)



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

a = [eval(input()) for _ in range(n)]



a.sort()



ans =""

for i in range(n):

	ans += a[i]



print(ans)
n, l = list(map(int, input().split()))
s = []
for _ in range(n):
    s.append(eval(input()))
s.sort()
ans = "".join(s)
print(ans)

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

-s = [] -for _ in range(n): -    s.append(eval(input())) -s.sort() -ans = "".join(s) +a = [eval(input()) for _ in range(n)] +a.sort() +ans = "" +for i in range(n): +    ans += a[i]