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

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

#print(S)

S.sort()

ans=''.join(S)

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

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

#print(s)

print(*s,sep="")

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

n, l = map(int, input().split())
s = sorted([input() for i in range(n)])
# print(s)
print(*s, sep="")

-N, L = list(map(int, input().split())) -S = [eval(input()) for i in range(N)] -# print(S) -S.sort() -ans = "".join(S) -print(ans) +n, l = map(int, input().split()) +s = sorted([input() for i in range(n)]) +# print(s) +print(*s, sep="")