object Main {

  def main(args: Array[String]): Unit = {
    import scala.io.StdIn._
    val Array(n, l) = readLine().split(" ").map(_.toInt)
    val S: Array[String] = (0 until n).map(_ => readLine()).toArray
    println(S.sorted.mkString)
  }

}
