def getlist():

    return list(map(int, input().split()))

  

a,b = getlist()

lis = []

for i in range(a):

  lis.append(input().strip())

  

lis.sort()

print(("".join(lis)))

import sys

from collections import defaultdict, deque, Counter

import math

 

# import copy

from bisect import bisect_left, bisect_right

# import heapq

 

# sys.setrecursionlimit(1000000)

 

# input aliases

input = sys.stdin.readline

 

getS = lambda: input().strip()

getN = lambda: int(eval(input()))

getList = lambda: list(map(int, input().split()))

getZList = lambda: [int(x) - 1 for x in input().split()]

 

INF = 10 ** 20

MOD = 10**9 + 7

divide = lambda x: pow(x, MOD-2, MOD)



def main():

    n, l = getList()

    lis = []

    for i in range(n):

        lis.append(getS())



    lis.sort()

    print(("".join(lis)))



if __name__ == "__main__":

    main()

   
def getlist():
    return list(map(int, input().split()))


a, b = getlist()
lis = []
for i in range(a):
    lis.append(input().strip())
lis.sort()
print(("".join(lis)))

import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right

# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]
INF = 10**20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)


def main():
    n, l = getList()
    lis = []
    for i in range(n):
        lis.append(getS())
    lis.sort()
    print(("".join(lis)))


if __name__ == "__main__":
    main()

-def getlist(): -    return list(map(int, input().split())) +import sys +from collections import defaultdict, deque, Counter +import math + +# import copy +from bisect import bisect_left, bisect_right + +# import heapq +# sys.setrecursionlimit(1000000) +# input aliases +input = sys.stdin.readline +getS = lambda: input().strip() +getN = lambda: int(eval(input())) +getList = lambda: list(map(int, input().split())) +getZList = lambda: [int(x) - 1 for x in input().split()] +INF = 10**20 +MOD = 10**9 + 7 +divide = lambda x: pow(x, MOD - 2, MOD) -a, b = getlist() -lis = [] -for i in range(a): -    lis.append(input().strip()) -lis.sort() -print(("".join(lis))) +def main(): +    n, l = getList() +    lis = [] +    for i in range(n): +        lis.append(getS()) +    lis.sort() +    print(("".join(lis))) + + +if __name__ == "__main__": +    main()