
object main extends App{
  val l1 = io.StdIn.readLine()
  val N = l1.split(" ")(0).toInt
  val L = l1.split(" ")(1).toInt

  val words = (0 until N).map((i) => {
    io.StdIn.readLine()
  })

  println(words.sorted.mkString(""))
}