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

s = [eval(input()) for _ in range(N)]

s.sort()

print(("".join(s)))
N, L = list(map(int, input().split()))

s = [eval(input()) for _ in range(N)]

ans = ""



s.sort()

for si in s:

    ans += si

print(ans)

N, L = list(map(int, input().split()))
s = [eval(input()) for _ in range(N)]
s.sort()
print(("".join(s)))

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

+ans = "" -print(("".join(s))) +for si in s: +    ans += si +print(ans)