object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val grouped = List.fill(sc.nextInt())(sc.next())
    .groupBy(identity)
    .view
    .mapValues(_.length)
  val (_, max) = grouped.maxBy { case (_, count) => count}
  val names = grouped.collect { case (name, count) if count == max => name}.toSeq
  names.sorted.foreach(println)
}
