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.max
      if minus > element
				spindles.delete(minus)
        next
      end
      element -= minus
      result << spindles.delete(minus)
    end
    puts result.sort.join(' ')
  end
end

weight