fun main() {
    val n = readLine()!!.toInt()
    val s = mutableListOf<String>()
    for (i in 0 until n) {
        s.add(readLine()!!)
    }
    var maxNum: Int? = null
    s.groupingBy { it }.eachCount().toList().sortedBy { it.first }.sortedByDescending { it.second }.forEach {
        if (maxNum != null && maxNum != it.second) {
            return@forEach
        }
        println(it.first)
        maxNum = it.second
    }
}