#!/usr/bin/env python3 from collections import Counter import sys MOD = 998244353 def main(): N = int(input(), 16) oc = format(N, "o") c = Counter(list(oc)) mx = max(c.values()) print(*sorted([k for k, v in c.items() if v == mx]), sep=" ") return if __name__ == '__main__': main()