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_value = [] max_cnt = max(count.values()) for i in count: if max_cnt == count[i]: max_value.append(i) print(*sorted(max_value))