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

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

print(("".join(sorted(d))))
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()))
d = [eval(input()) for _ in range(N)]
print(("".join(sorted(d))))

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())) -d = [eval(input()) for _ in range(N)] -print(("".join(sorted(d)))) +n, l = list(map(int, input().split())) +s = [eval(input()) for _ in range(n)] +s.sort() +print(("".join(s)))