Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		n, err := nextInt()
		if err != nil {
			break
		}

		w := 512
		weights := make([]int, 10)
		for i := 9; i >= 0; i-- {
			if n >= w {
				weights[i] = w
				n -= w
			}
			w /= 2
		}

		output := []int{}
		for i := 0; i < 10; i++ {
			if weights[i] > 0 {
				output = append(output, weights[i])
			}
		}
		outputStr := fmt.Sprint(output)
		fmt.Println(outputStr[1:(len(outputStr) - 1)])
	}
}

Python: while 1:
    try:
        w = [512,256,128,64,32,16,8,4,2,1]
        x,y = [],[]
        n = int(input())

        for i in w:
            weight = n // i
            n %= i
            x.append(weight)

        for i in range(10):
            if x[i] != 0:
                y.append(w[i])

        y.reverse()        
        print(*y)
    except:
        break

Python: while 1:print(*[int(b)*2**i for i,b in enumerate(bin(int(input()))[2:][::-1])if int(b)])

Python: #!/usr/bin/env python

while True:
	try:
		n = input()
	except:
		break
	ans = []
	for j in range(10):
		if n & (2 ** j):
			ans.append(str(2 ** j))
	print(" ".join(ans))

Python: while 1:
    try:
        n=int(input())
        ans=[]
        for i in range(10):
            if n>=2**(9-i):
                ans.append(2**(9-i))
                n-=2**(9-i)
        print(' '.join(map(str,ans[::-1])))
    except:break

Python: # AOJ 0031 Weight
# Python3 2018.6.14 bal4u

w = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512];

while True:
	try:
		a = int(input())
	except EOFError:
		break
		
	ans = []
	i = 0
	while a > 0:
		if a & 1:
			ans.append(w[i])
		a >>= 1
		i += 1
	print(*ans)

Python: blist = [int(2**i) for i in range(10)]
while(1):
    try:
        n = int(input())
        b_ = bin(n)
        b = list(b_)[-1:1:-1]
        for i in range(len(b)):
            if b[i] == "1":
                if i == len(b) - 1:
                    print(blist[i])
                else:
                    print(blist[i], end= " ")
    except EOFError:
        break

Python: # Aizu Problem 0031: Weight
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

while True:
    try:
        w = int(input())
    except EOFError:
        break
    b = bin(w)[2:][::-1]
    while len(b) < 10:
        b += '0'
    out = ""
    for k in range(10):
        if b[k] == '1':
            out += str(2**k) + ' '
    print(out[:-1])

Python: # -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 木 10/26 19:32:38 2017

# Usage
#
"""
import sys

WEIGHTS = [2 ** i for i in range(9)]

def solver_greedy(target_weight: int):
    """
    >>> print(solver_greedy(127))
    [1, 2, 4, 8, 16, 32, 64]
    >>> print(solver_greedy(10))
    [2, 8]
    """
    res = []
    for w in sorted(WEIGHTS, reverse=True):
        if w <= target_weight:
            res.append(w)
            target_weight = target_weight - w
        if target_weight == 0:
            return sorted(res)


if __name__ == '__main__':
    data = []
    for line in sys.stdin:
        data.append(line.rstrip("\n"))

    data = [int(d) for d in data[:-1]]

    for i in data:
        res = solver_greedy(i)

        for x,n in enumerate(res):
            sys.stdout.write(str(n))
            if x + 1 == len(data):
                sys.stdout.write("\n")
                break
            sys.stdout.write(" ")

Python: import math
while True:
  try:
    n = int(input())
    ans = []
    while n != 0:
      if n%2 == 1:
        n -= 1
        ans.append( 1 )
      else:
        buff = []
        tmp = n
        while True:
          tmp //= 2
          buff.append(2)
          if tmp%2 != 0:
            n -= math.pow(2, len(buff))
            ans.append( math.pow(2, len(buff)) )
            break
    print( ' '.join( [f'{int(a)}' for a in ans] ) )
  except:
    break

Python: import sys
for line in sys.stdin:
    l = bin(int(line)).lstrip("0b")[::-1]
    ans = []
    for i,bit in enumerate(l):
        if bit == "1":
            ans.append(2**i)
    print(*ans)

Python: while 1:
    try:
        w = int(input())
    except:
        break

    fun = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
    anslist = []
    for f in reversed(fun):
        if w - f >= 0:
            anslist.append(f)
            w -= f
    print(' '.join(str(ans) for ans in reversed(anslist)))

Python: import sys
for d in sys.stdin:
 c=0
 a=[]
 for b in bin(int(d))[2:][::-1]:
  if int(b):a+=[int(b)*2**c]
  c+=1
 print(*a)

Python: # coding=utf-8


def calc_weights(weight):
    weights_list = []
    counter = 0
    while weight > 0:
        if weight % 2 == 0:
            weight /= 2
        else:
            weights_list.append(2**counter)
        counter += 1
    print(' '.join(map(str, weights_list)))


if __name__ == '__main__':
    while True:
        try:
            W = int(input())
            calc_weights(W)
        except EOFError:
            break

Python: import sys
Ws = sys.stdin.readlines()
for w in Ws:
    b = bin(int(w))
    t = {0 : 1,
         1 : 2,
         2 : 4,
         3 : 8,
         4 : 16,
         5 : 32,
         6 : 64,
         7 : 128,
         8 : 256,
         9 : 512,
         10: 1024}
    print(* [t[digi] for digi in range(len(b)-2) if b[-1-digi] == '1'])

Python: import sys


for line in sys.stdin:
    waight = ["1", "2", "4", "8", "16", "32", "64", "128", "256", "512"]
    ans = []
    n = bin(int(line))[2:].zfill(10)
    for i, x in enumerate(n[::-1]):
        if x == "1":
            ans.append(waight[i])
    print(" ".join(ans))

Python: w_a = [1,2,4,8,16,32,64,128,256,512]

while True:
    try:
        w_b = int(input())
        b = list(bin(w_b))[::-1]
        w_c = []
        for i in range(len(b)):
            if b[i] == "b":
                break
            elif b[i] == "1":
                w_c.append(w_a[i])
        print(*w_c)
    except:
        break

Python: import math
import fileinput
weight = [2**x for x in range(10)]
for line in fileinput.input():
    if line == "\n":
        break
    else:
        w = int(line)
        log = int(math.log2(w))
        w_type = []
        for i in range(log, -1, -1):
            if sum(w_type) + weight[i] <= w:
                w_type.append(weight[i])
        for i in reversed(range(len(w_type))):
            if i == 0:
                print(w_type[i])
            else:
                print(w_type[i], end=" ")

Python: while True:
    try:
        num = int(input())
        L = []
        for i in range(10):
            if num & (1<<i):
                L.append(2**i)
        print(" ".join(map(str,L)))
    except EOFError:
        break

Python: import sys
for d in sys.stdin:
 m=int(d)
 a,c=[],0
 while m:
  if m&1:a.append(2**c)
  c+=1
  m>>=1
 print(*a)

Python: while 1:
    try:m=int(input())
    except:break
    a,c=[],0
    while m:
        if m&1:a.append(2**c)
        c+=1
        m>>=1
    print(*a)

Python: import sys

l = [2 ** i for i in range(10)]
for line in sys.stdin:
	blist = list(bin(int(line))[2:])
	blist.reverse()
	#print(blist)
	anslist = []
	for i in range(len(blist)):
		if blist[i] == "1":
			anslist.append(str(l[i]))
	print(' '.join(anslist))

Python: import sys
print("\n".join((" ".join(str(2**i)for i, n in enumerate(bin(int(s))[:1:-1])if n=="1")for s in sys.stdin.readlines())))

Python: import sys
for line in sys.stdin:
    ans=[]
    n=1
    for i in reversed(bin(int(line))):
        if i=="1":
            ans.append(n)
        n*=2
    print(*ans)