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

weight