import java.io.{BufferedReader, InputStreamReader}

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt
    val strings = mutable.HashMap.empty[String,Int]
    var max = 0
    var maxStrings = mutable.PriorityQueue.empty[String](implicitly[Ordering[String]].reverse)

    for {
      i <- 0 until n
    } {
      val s = in.readLine()
      val count = strings.getOrElse(s, 0)
      strings.update(s, count + 1)
      if (max == count) {
        max = count + 1
        maxStrings = mutable.PriorityQueue.empty[String](implicitly[Ordering[String]].reverse)
      }

      if (max == count + 1) {
        maxStrings += s
      }
    }

    maxStrings.foreach { key =>
      System.out.println(
        key
      )
    }
  }
}
