
object Main extends App {
  val n: Int = io.StdIn.readLine().toInt

  var map: Map[String, Int] = Map.empty
  for(i <- 0 until  n){
    val str: String = io.StdIn.readLine()

    map += (str -> (map.getOrElse(str, 0) + 1))
  }

  var ans: Seq[String] = Seq.empty
  var max: Int = Integer.MIN_VALUE

  map.foreach(f = kv => {
    if(max == kv._2) {
      ans = ans :+ kv._1
    }
    if(max < kv._2) {
      ans = Seq(kv._1)
      max = kv._2
    }

  })

  ans.sortBy(_.toLowerCase).map(println)

}
