import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val hash = Map[String, Int]()
  val N = in.next().toInt
  for (_ <- 1 to N) {
    val s = in.next()
    if (!hash.contains(s)) {
      hash += (s -> -1)
    }
    else {
      hash(s) -= 1
    }
  }

  var hoge = 0
  val fuga = hash.toSeq.map {case (k, v) => (v, k)}.sorted
  for ((v, k) <- fuga) {
    if (hoge == 0 || hoge == v) {
      pw.println(k)
      hoge = v
    }
  }
  pw.flush()
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.toList))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
