fun main(args: Array<String>) {

    val n = readLine()!!.toInt()
    val aa = Array(n){readLine()!!}

    val wa = aa.groupBy { it }.mapValues { it.value.count() }
    val max = wa.values.max()

    val res = wa.filter { it.value == max }.keys.sorted().joinToString("\n")
    println(res)
}