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

weight