def weight
  master = Array.new(10) { |i| 2**i }.reverse
  while gets
    element = $_.to_i
    puts master.select { |i| i <= element }.each_with_object([]) { |i, tmp|
      (element -= i) && (tmp << i) if i <= element
    }.sort.join(' ')
  end
end

weight