x = gets.to_i
y = gets.to_i
l = gets.to_i
xx = []
yy = []
ll = []

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

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

ary.each do |i|

  if  x / i  > 0
    p "#{x - (i * (x/i))} :: x - (i * (x/i))"
    p "#{i} :: i"
    x_hash[i] = x/i
    x = x - (i * (x/i))
    puts "#{x} ::x test"

  else
    next
  end
end

ary.each do |i|

  if  y / i  > 0
    p "#{x - (i * (x/i))} :: x - (i * (x/i))"
    p "#{i} :: i"
    y_hash[i] = y/i
    y = y - (i * (y/i))
    puts "#{x} ::x test"

  else
    next
  end
end

ary.each do |i|

  if  l / i  > 0
    p "#{x - (i * (x/i))} :: x - (i * (x/i))"
    p "#{i} :: i"
    l_hash[i] = l/i
    l = l - (i * (l/i))
    puts "#{x} ::x test"

  else
    next
  end
end

puts x_hash.keys.reverse.join(" ")
puts y_hash.keys.reverse.join(" ")
puts l_hash.keys.reverse.join(" ")
