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

lst = []

for i in range(n):

    si = eval(input())

    lst.append(si)

lst.sort()



ans = ''

for i in range(n):

    ans += lst[i]

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

lst = []

for i in range(n):

    s = eval(input())

    lst.append(s)



lst.sort()



ans = ''

for i in range(n):

    ans += lst[i]

print(ans)
n, l = list(map(int, input().split()))
lst = []
for i in range(n):
    si = eval(input())
    lst.append(si)
lst.sort()
ans = ""
for i in range(n):
    ans += lst[i]
print(ans)

n, l = list(map(int, input().split()))
lst = []
for i in range(n):
    s = eval(input())
    lst.append(s)
lst.sort()
ans = ""
for i in range(n):
    ans += lst[i]
print(ans)

-    si = eval(input()) -    lst.append(si) +    s = eval(input()) +    lst.append(s)