import Foundation

let rd = readLine()!.split(separator: " ").map({Int($0)!})
var strArr = [String]()
for i in 0 ..< rd[0] {
    strArr.append(readLine()!)
}
let srtArr = strArr.sorted()

print(srtArr.joined(separator: ""))