fun main(args: Array<String>){
    val initialInput = readLine()!!.split(' ')
                                   .map { it.toInt() }
    val quantity = initialInput[0]
    val length = initialInput[1]

    val textArray = Array(quantity){""}

    val array = toArrayfromInput(quantity, textArray)
    println(array.toList().sorted().joinToString(""))
}
tailrec fun toArrayfromInput(maxCount: Int, array: Array<String>, count: Int = 0): Array<String>{
    array[count] = readLine()!!
    return if (count < maxCount-1) toArrayfromInput(maxCount, array, count+1)
           else                   array
}