import scala.util.control.Breaks

object Main extends App {
  val n = scala.io.StdIn.readInt()
  var sArray = Vector.empty[String]
  (1 to n).foreach(_ =>
    sArray :+= scala.io.StdIn.readLine()
  )
  val groupS = sArray.groupBy(s => s).map(s => (s._1, s._2.length)).toVector.sortBy(s => s._2).reverse
  val maxLength = groupS(0)._2

  val b = new Breaks
  var resultArray = Vector.empty[String]
  b.breakable {
    groupS.foreach { s =>
      if(s._2 != maxLength) {
        b.break()
      } else {
        resultArray :+= s._1
      }
    }
  }
  resultArray.sorted.foreach { r =>
    println(r)
  }
}