require "big" cnt = gets.to_s.to_big_i(16).to_s(8).chars.tally max = cnt.values.max ans = [] of Int32 cnt.each do |k,v| if v == max ans << k.to_i end end puts ans.sort.join(" ")