object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val length = sc.nextInt()
    val input: Array[String] = Array.fill(length)(sc.next())

    val grouped = input.groupBy(identity).map(i => (i._1, i._2.length))
    val max = grouped.values.max
    val ans = grouped.filter(_._2 == max).keys.toArray.sorted.mkString("\n")

    println(ans)
  }
}
