from collections import Counter def convert_N(v, n): ret = [] while v > 0: ret.append(v % n) v //= n return ret[::-1] N = input() # print(int(N, 16)) hachi = convert_N(int(N, 16), 8) cnt = list(Counter(hachi).items()) cnt.sort(key=lambda x: x[1], reverse=True) vmax = cnt[0][1] ans = [] for i in range(len(cnt)): if cnt[i][1] == vmax: ans.append(cnt[i][0]) ans.sort() print(*ans)