from collections import Counter a=input().split() b=Counter(a) c=max(list(b.values())) d=[] for ca,v in b.items(): if v==c: d.append(ca) d.sort() print(d[0],c)