import java.util.*

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val N = scn.nextInt()

    var map = mutableMapOf<String, Int>()
    var list = mutableListOf<String>()
    var max = 1
    for(i in 1..N){
        val S = scn.next()

        if(map.containsKey(S)) {
            var tmp = map[S]
            if (tmp != null) {
                map[S] = tmp + 1

                if(tmp+1 > max) {
                    max = tmp+1
                    list.clear()
                    list.add(S)
                }else if(tmp+1 == max){
                    list.add(S)
                }
            }
        }else{
            map.put(S,1)
            if(max==1) list.add(S)
        }
    }

    list.sort()

    for(i in list){
        println(i)
    }

}