object Main {

  import java.util.Scanner

  def main(args: Array[String]): Unit = {
    val scanner = new Scanner(System.in)
    var str = scanner.next()
    val num = str.toInt
    str = scanner.next()
    val len = str.toInt

    var list: Seq[String] = List()
    for (i <- 0 until num) {
      str = scanner.next()
      list = list :+ str
    }

    val sortedList = list.sorted

    sortedList.foreach(print)

  }
}
