fun main(args: Array<String>) {
    val input = readLine()!!.split(" ").map { it.toInt() }
    val n = input[0]
    val l = input[1]
    val s: Array<String> = Array(n) { "" }
    for (i in 0 until n) {
        s[i] = readLine()!!
    }

    var tmp = ""
    for (i in 0 until n - 1) {
        for (j in i + 1 until n) {
            if (s[j] < s[i]) {
                tmp = s[i]
                s[i] = s[j]
                s[j] = tmp
            }

        }
    }

    print(s.joinToString(""))
}