object Main {
  def main(args: Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val xs = List.fill(n)(sc.next)
    
    def maxBy[A, B : Ordering](elements: TraversableOnce[A])(f: A => B): Seq[A] = {
      elements.foldRight((Option.empty[B], List.empty[A])) { case (element, (best, elements)) =>
        val current = f(element)
        val result = best.fold(0)(implicitly[Ordering[B]].compare(current, _))
        if (result > 0) {
          (Some(current), List(element))
        } else {
          (best, if (result == 0) element +: elements else elements)
        }
      }._2
    }
    
    val values = xs.groupBy(identity).mapValues(_.size)
    val maxValues = maxBy(values)(_._2)
    val sortedMaxValues = maxValues.sortBy(_._1)
    println(sortedMaxValues.foldLeft("")((z, x) => z + x._1.toString + "\n"))
  }
}