object Main extends App {
  def mostFrequents(words: Seq[String]): Seq[String] = {
    val treeMap = new scala.collection.mutable.TreeMap[String, Int]()

    @scala.annotation.tailrec
    def loop(words: Seq[String], max: Int): Int =
      words match {
        case Seq() => max
        case x :: xs =>
          val count = treeMap.getOrElseUpdate(x, 0)
          treeMap.update(x, count + 1)
          loop(xs, (count + 1).max(max))
      }

    val max = loop(words, 0)
    treeMap.filter { case (_, count) => count == max }.keys.toSeq
  }

  val sc = new java.util.Scanner(System.in)
  mostFrequents(List.fill(sc.nextInt())(sc.next())).foreach(println)
}
