
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val map = sortedMapOf<String, Int>()
    var maxCount = 0
    0.until(n).forEach {
        val s = readLine() ?: return
        val count = map[s]?.let { it + 1 } ?: 1
        map[s] = count
        if (count > maxCount) {
            maxCount = count
        }
    }
    map.entries
        .filter {
            it.value == maxCount
        }.sortedBy { it.key }
        .forEach {
            println(it.key)
        }
}