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

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



print(("".join(s)))

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

S = list(eval(input()) for _ in range(N))

S.sort()

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

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

-s = sorted([eval(input()) for i in range(N)]) -print(("".join(s))) +S = list(eval(input()) for _ in range(N)) +S.sort() +print(("".join(S)))