object Main extends App{
  import scala.io.StdIn._
  val n=readInt()
  var map=scala.collection.mutable.Map[String,Int]()
  var ss=scala.collection.mutable.Map[String,Int]()
  var ans:Array[String]=Array.empty
  var max=0
  val s=new Array[String](n)
  for {i <- (0 until(n))}{
    s(i)=readLine()
    map(s(i)) = if(map.contains(s(i))) map(s(i)) + 1 else 1
    max=Math.max(map getOrElse(s(i),0), max)
  }
  for {i <- (0 until(n))}{
    val num= map getOrElse(s(i),0)
    val flag= ss isDefinedAt(s(i))
    if(num == max && !flag){
      ans = ans :+ s(i)
      ss update (s(i), 0)
    }
  }
  println(ans.sorted.mkString("\n"))
}