fun main(array: Array<String>) {
    val n = readLine()!!.toInt()
    val list = mutableMapOf<String, Int>()
    var max = 1
    repeat(n) {
        val s = readLine()!!
        if(list.containsKey(s)) {
            list[s] = list[s]!!.plus(1)
            if(max < list[s]!!) max = list[s]!!
        }
        else {
            list += s to 1
        }
    }
    list.filter { it.value == max }.toSortedMap().forEach{ println(it.key)}
}