object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn._
    val Array(n, l) = readLine().split(' ').map(_.toInt)
    val str = (0 until n).map(_ => readLine())
    println(str.sorted.fold("")(_ + _))
  }
}
