from collections import Counter N = int(input(), base=16) count = Counter(oct(N)[2:]) ans = [] max_count = max(count.values()) for i in map(str, range(8)): if count[i] == max_count: ans.append(i) print(*ans)