def weight
  master = Array.new(10) { |i| 2**i }
  while gets
    element = $_.to_i
    spindles = master.select { |i| i <= element }
    result = []
    while true
      break if element <= 0
      minus = spindles.delete(spindles.max)
      next if minus > element
      element -= minus
      result << minus
    end
    puts result.sort.join(' ')
  end
end

weight