 fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    //val map = mutableMapOf<String, Int>()
    val map = hashMapOf<String, Int>()
    for (i in 0 until n) {
        val str = readLine()!!
        map[str] = (map[str] ?: 0) + 1
    }
    val result = map.toList().sortedByDescending { it.second }
    var max = -1
    var index = 0
    var maxlist = mutableListOf<String>()
    while (true) {
        if (index >= result.count()) {
            break
        }
        if (max == -1 || max == result[index].second) {
            max = result[index].second
            maxlist.add(result[index].first)
        } else {
            break
        }
        index += 1
    }
    print(maxlist.sorted().joinToString("\n"))
}