object Main extends App {
	val scanner = new java.util.Scanner(System.in)
	val N = scanner.nextInt()
	var map = Map[String, Int]()

	for(_ <-0 until N){
		val s = scanner.next
		map += s->(1 + map.getOrElse(s, 0))
	}

	val tmp = map.toArray.sortWith((l, r) => if(l._2 == r._2) l._1 < r._1 else l._2 > r._2)
	val vmax = tmp(0)._2

	tmp.takeWhile(_._2 == vmax).foreach(z => println(z._1))

}