# -*- coding: utf-8 -*-

"""

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



"""

import sys

from sys import stdin

input = stdin.readline





def solve(data):

    data.sort()

    return data





def main(args):

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

    data = [input().strip() for _ in range(N)]

    ans = solve(data)

    print(*ans, sep='')





if __name__ == '__main__':

    main(sys.argv[1:])

    

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

S = []

for i in range(N):

    line = eval(input())

    S.append(line)

S.sort()

print(("".join(S)))
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc042/tasks/abc042_b
"""
import sys
from sys import stdin

input = stdin.readline


def solve(data):
    data.sort()
    return data


def main(args):
    N, L = map(int, input().split())
    data = [input().strip() for _ in range(N)]
    ans = solve(data)
    print(*ans, sep="")


if __name__ == "__main__":
    main(sys.argv[1:])

N, L = list(map(int, input().split()))
S = []
for i in range(N):
    line = eval(input())
    S.append(line)
S.sort()
print(("".join(S)))

-# -*- coding: utf-8 -*- -""" -https://beta.atcoder.jp/contests/abc042/tasks/abc042_b -""" -import sys -from sys import stdin - -input = stdin.readline - - -def solve(data): -    data.sort() -    return data - - -def main(args): -    N, L = map(int, input().split()) -    data = [input().strip() for _ in range(N)] -    ans = solve(data) -    print(*ans, sep="") - - -if __name__ == "__main__": -    main(sys.argv[1:]) +N, L = list(map(int, input().split())) +S = [] +for i in range(N): +    line = eval(input()) +    S.append(line) +S.sort() +print(("".join(S)))