object Main extends App {
	val N = scala.io.StdIn.readInt
	var map = Map[String, Int]()

	for(i<-0 until N){
		val s = scala.io.StdIn.readLine
		map += s->(1 + map.getOrElse(s, 0))
	}

	val tmp = map.toList.sortWith((l, r) => if(l._2 == r._2) l._1 < r._1 else l._2 > r._2)
	val vmax = tmp.head._2
	
	tmp.takeWhile(_._2 == vmax).foreach(z => println(z._1))
}