
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val pw = new java.io.PrintWriter(System.out)
  val s = Array.fill(sc.nextInt())(sc.next()).groupMapReduce(identity)(_ => 1)(_ + _)
  val max = s.values.max
  val ans = s.filter{case (k, v) => v == max}.map{case (k, v) => k}.toList.sorted
  ans.foreach(pw.println(_))
  pw.flush()
}