import scala.io.Source.stdin

object Main {
  def countValue(i: Iterator[String], count: Map[Int, Int] = Map()): Map[Int, Int] = {
    if (i.hasNext) {
      val n = i.next.toInt
      if (count.contains(n)) countValue(i, count + (n -> (count(n) + 1)))
      else countValue(i, count + (n -> 1))
    } else count
  }

  def results(i: Iterator[String]): List[Int] = {
    val countList = countValue(i).toList.sortWith(_._2 > _._2)
    val filterMaxCount = countList.filter(_._2 == countList.head._2)
    (for ((t1,t2) <- filterMaxCount) yield t1).sortWith(_<_)
  }

  def main(args: Array[String]): Unit = {
    results(stdin.getLines).foreach(println)
  }
}