x = gets.to_i
y = gets.to_i
l = gets.to_i

ARY = [512, 256 , 128, 64, 32, 16, 8, 4, 2, 1]

# x_hash = Hash.new
# y_hash = Hash.new
# l_hash = Hash.new

#三回定義は面倒なのでメソッド作成
class Foo
  # attr_reader :ary
  #
  # def initialize(ary)
  #   @ary = ary
  # end

  def hoge(s)
    s_hash = Hash.new
    ARY.each do |i|
      if  s / i  > 0
        # p "#{x - (i * (x/i))} :: x - (i * (x/i))"
        # p "#{i} :: i"
        s_hash[i] = s/i
        s = s - (i * (s/i))
        # puts "#{x} ::x test"
      else
        #0だったらaryの参照する数を1つずらす
        next
      end
    end
    #最終出力
    puts s_hash.keys.reverse.join(" ")
  end
end

foo1 = Foo.new
foo1.hoge(x)
foo2 = Foo.new
foo2.hoge(y)
foo3 = Foo.new
foo3.hoge(l)

