
import java.util.*
import java.lang.*

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()

    var map = HashMap<String,Int>()
    var max = 1
    var strmap = HashMap<Int,ArrayList<String>>()

    strmap[1] = ArrayList()

    for(i in 0 until N){
        val str = readLine()!!.toString()
        if(map.containsKey(str)){
            map[str] = map[str]!! + 1
            if(!strmap.containsKey(map[str])){
                strmap[map[str]!!] = ArrayList()
            }
            strmap[map[str]]!!.add(str)

            max = Math.max(max,map[str]!!)
        }else{
            map[str] = 1
            strmap[1]!!.add(str)
        }
    }

    TreeSet(strmap[max]!!).forEach { 
        println(it)
    }

}