x, y = list(map(int, input().split()))

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

print(("".join(s)))
n, l = list(map(int, input().split()))

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

s = sorted(k)

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

n, l = list(map(int, input().split()))
k = [eval(input()) for _ in range(n)]
s = sorted(k)
print(("".join(s)))

-x, y = list(map(int, input().split())) -s = sorted([eval(input()) for i in range(x)]) +n, l = list(map(int, input().split())) +k = [eval(input()) for _ in range(n)] +s = sorted(k)