# https://atcoder.jp/contests/abc042/tasks/abc042_b



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

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

s = sorted(s)

print(("".join(s)))

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

print(("".join(sorted([eval(input()) for _ in range(n)]))))

# https://atcoder.jp/contests/abc042/tasks/abc042_b
N, L = list(map(int, input().split()))
s = [eval(input()) for _ in range(N)]
s = sorted(s)
print(("".join(s)))

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

-# https://atcoder.jp/contests/abc042/tasks/abc042_b -N, L = list(map(int, input().split())) -s = [eval(input()) for _ in range(N)] -s = sorted(s) -print(("".join(s))) +n, l = list(map(int, input().split())) +print(("".join(sorted([eval(input()) for _ in range(n)]))))