import Foundation

func readInts() -> [Int] {
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let aryInts = readInts()
    let n = aryInts[0]
    let _ = aryInts[1]
    var ans = String()
    
    var aryStr: [String] = []
    
    for _ in 1...n {
        aryStr.append(readLine()!)
    }
    let aryans = aryStr.sorted { $0 < $1 }
    
    for i in 0..<aryans.count {
        ans += aryans[i]
    }
    
    print(ans)
}

main()


