def main():

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

    words = []



    for i in range(n):

        words.append(eval(input()))



    words.sort()

    print((''.join(words)))



if __name__ == "__main__":



    main()

def main():

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

    words = [eval(input()) for i in range(n)]

    # words = []



    # for i in range(n):

    #     words.append(input())



    words.sort()

    print((''.join(words)))



if __name__ == "__main__":



    main()

def main():
    n, l = list(map(int, input().split()))
    words = []
    for i in range(n):
        words.append(eval(input()))
    words.sort()
    print(("".join(words)))


if __name__ == "__main__":
    main()

def main():
    n, l = list(map(int, input().split()))
    words = [eval(input()) for i in range(n)]
    # words = []
    # for i in range(n):
    #     words.append(input())
    words.sort()
    print(("".join(words)))


if __name__ == "__main__":
    main()

-    words = [] -    for i in range(n): -        words.append(eval(input())) +    words = [eval(input()) for i in range(n)] +    # words = [] +    # for i in range(n): +    #     words.append(input())