fun main (args: Array<String>) {
  val (N, L) = readLine()!!.split(" ").map(String::toInt)
  val strings = mutableListOf<String>()
  for (i in 0 until N) {
    strings.add(readLine()!!)
  }
  strings.sort()
  println(strings.joinToString(""))
}