import java.util.*

fun main(args:Array<String>){
    val (n,l) = readLine()!!.split(" ").map{it.toInt()}
    val s = ArrayList<String>()
    for(i in 0 until n){
        s.add(readLine()!!)
    }
    s.sort()
    s.forEach{
        print(it)
    }
    println()
}
