import Foundation

func main(){
    let counter = Int(readLine()!)!
    var aryStr = [String]()
    var aryInts = [Int]()
    
    for _ in 1...counter {
        aryStr.append(readLine()!)
        aryInts.append(1)
    }
    let ziped = zip(aryStr,aryInts)
    let dicUniq = Dictionary(ziped, uniquingKeysWith: +)
    let max = dicUniq.values.max()
    var ans = [String]()
    
    for dic in dicUniq {
        print(dic)
        if dic.value == max {
            ans.append(dic.key)
        }
    }
    ans.sort() { $0 < $1 }
    for a in ans {
        print(a)
    }
}

main()