from collections import Counter x = input().lower() x = int(x, 16) x = format(x, "o") c = Counter(list(x)) mv = max(c.values()) ans = [k for k,v in c.items() if v == mv] ans.sort() print(*ans)