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

a = [input() for i in range(n)]



a.sort()



for aa in a:

  print(aa, end="")

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

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

print(*s,sep="")

n, l = map(int, input().split())
a = [input() for i in range(n)]
a.sort()
for aa in a:
    print(aa, end="")

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

-a = [input() for i in range(n)] -a.sort() -for aa in a: -    print(aa, end="") +s = sorted([input() for i in range(n)]) +print(*s, sep="")