# -*- coding utf-8 -*-



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



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



s.sort()



print(*s,sep="")

# -*- coding utf-8 -*-

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

s=[]



for i in range(n):

    X=str(eval(input()))

    s.append(X)



f=sorted(s)

ans=''.join(f)

print(ans)

# -*- coding utf-8 -*-
n, l = map(int, input().split())
s = [str(input()) for i in range(n)]
s.sort()
print(*s, sep="")

# -*- coding utf-8 -*-
n, l = list(map(int, input().split()))
s = []
for i in range(n):
    X = str(eval(input()))
    s.append(X)
f = sorted(s)
ans = "".join(f)
print(ans)

-n, l = map(int, input().split()) -s = [str(input()) for i in range(n)] -s.sort() -print(*s, sep="") +n, l = list(map(int, input().split())) +s = [] +for i in range(n): +    X = str(eval(input())) +    s.append(X) +f = sorted(s) +ans = "".join(f) +print(ans)