fun main(args: Array<String>) {
    val map = mutableMapOf<String, Int>()
    val n = readInteger()
    repeat(n) {
        val s = readLine()!!
        map[s] = if (map[s] == null) 1 else map[s]!! + 1
    }

    val maxNum = map.maxBy { it.value }!!.value
    val list = mutableListOf<String>()
    for (entry in map) {
        if (entry.value == maxNum) {
            list += entry.key
        }
    }

    println(list.sorted().joinToString("\n"))
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
