object Main extends App {
  val input = readLine
  val countOfWords = input.split(" ")(0).toInt
  def getWordsList(i: Int, list: List[String]): List[String] = {
    val word = readLine
    if(countOfWords < i ) list else getWordsList(i + 1, list :+ word)
  }
  val wordsList: List[String] = getWordsList(1, List.empty)
  println(wordsList.sorted.mkString(""))
}
