from collections import Counter as cnt ten = int(input(),16) eight = [] st = ''.join(format(ten,'o')) for i in range(len(st)): eight.append(st[i]) count = cnt(eight) max_cnt = max(count.values()) for i in count: if max_cnt == count[i]: print(i,end=' ')