import Foundation

var input = readLine()
var inputs = input!.components(separatedBy: " ")

var N = Int(inputs[0])!
var L = Int(inputs[1])!

var strs : [String] = [String]()

for _ in 0 ..< N{
    strs.append(readLine()!)
}

strs.sort()

var ans : String = ""

for i in 0 ..< N{
    ans += strs[i]
}

print(ans)