def main(n,s):

    s.sort()

    val = s[0]

    idx = 0

    maxcount = 1

    lst = [[1, val]]

    for i in range(1,len(s)):

        if s[i] == val:

            lst[idx][0] += 1

            maxcount = max(maxcount, lst[idx][0])

        else:

            idx += 1

            val = s[i]

            lst.append([1,val])

    res = []

    for i in range(len(lst)):

        if lst[i][0] == maxcount:

            res.append(lst[i][1])

    res.sort()

    for i in range(len(res)):

        print((res[i]))

    

n = int(eval(input()))

s = [eval(input()) for _ in range(n)]

main(n,s)
from collections import Counter

def main(n,s):

    c = Counter(s)

    maxVal = max(c.values())

    res = sorted([k for k,v in list(c.items()) if v == maxVal])

    return res



n = int(eval(input()))

s = [eval(input()) for _ in range(n)]

for i in main(n,s):

    print(i)
def main(n, s):
    s.sort()
    val = s[0]
    idx = 0
    maxcount = 1
    lst = [[1, val]]
    for i in range(1, len(s)):
        if s[i] == val:
            lst[idx][0] += 1
            maxcount = max(maxcount, lst[idx][0])
        else:
            idx += 1
            val = s[i]
            lst.append([1, val])
    res = []
    for i in range(len(lst)):
        if lst[i][0] == maxcount:
            res.append(lst[i][1])
    res.sort()
    for i in range(len(res)):
        print((res[i]))


n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
main(n, s)

from collections import Counter


def main(n, s):
    c = Counter(s)
    maxVal = max(c.values())
    res = sorted([k for k, v in list(c.items()) if v == maxVal])
    return res


n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
for i in main(n, s):
    print(i)

+from collections import Counter + + -    s.sort() -    val = s[0] -    idx = 0 -    maxcount = 1 -    lst = [[1, val]] -    for i in range(1, len(s)): -        if s[i] == val: -            lst[idx][0] += 1 -            maxcount = max(maxcount, lst[idx][0]) -        else: -            idx += 1 -            val = s[i] -            lst.append([1, val]) -    res = [] -    for i in range(len(lst)): -        if lst[i][0] == maxcount: -            res.append(lst[i][1]) -    res.sort() -    for i in range(len(res)): -        print((res[i])) +    c = Counter(s) +    maxVal = max(c.values()) +    res = sorted([k for k, v in list(c.items()) if v == maxVal]) +    return res -main(n, s) +for i in main(n, s): +    print(i)