fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    val mp = mutableMapOf<String, Int>()
    var max = 1
    for (i in 1..n) {
        val s = readLine()!!
        if (mp[s] != null) {
            val cnt = mp[s]!! + 1
            mp[s] = cnt
            if (cnt > max) max = cnt
        }
        else mp[s] = 1
    }

    mp.filter{it.value == max}.toSortedMap().forEach {
        println(it.key)
    }

}
