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: b = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
b.reverse()
try:
    while 1:
        n = int(input())
        l = []
        for i in b:
            if i <= n:
                l.insert(0, i)
                n -= i
        print(*l)
except:
    pass

Python: import sys

def solve():
    for line in sys.stdin:
        W = int(line)
        pows = []
        idx = 0
        while W > 0:
            r = W % 2
            W = W // 2
            if not r == 0:
                end = ' ' if W > 0 else ''
                print(r*pow(2, idx), end=end)
            idx += 1
        print()
    

if __name__ == "__main__":
    solve()

Python: while True:
    try:
        Num = []
        n = int(input())
        while n > 0:
            if n % 2 == 1:
                Num.append(1)
                n = (n - 1) / 2
            else:
                Num.append(0)
                n = n / 2
        for i in range(len(Num)):
            if Num[i] == 1:
                print(2**i,end = " ")
        print(end = "\n")
    except EOFError:
        break

Python: while True:
    try:
        n=int(input())
    except:
        break

    l=list(format(n,'b'))
    
    for i in range(len(l)):
        if l[-i-1] == "1":
            print(2**i, end="")
            if i != len(l)-1:
                    print(" ",end="")
            
    print()

Python: import itertools
weight=[int(2**i) for i in range(10)]
while True:
	try:
		x=int(input())
		num=x
		a=[]
		while num!=0:
			for i in range(10):
				if num-weight[9-i]>=0:
					num-=weight[9-i]
					a.append(weight[9-i])
		for i in reversed(range(1,len(a))):
			print(a[i] ,end=" ")
		print(a[0])
	except EOFError:
		break

Python: import sys
for line in sys.stdin.readlines():
  m = int(line)
  c = 0
  l = []
  while m > 0:
    a = m % 2
    if a == 1:
      l.append(str(2**c))
    m = m // 2
    c += 1
  print(' '.join(l))

Python: while True:
    try:
        n=int(input())
    except:
        break

    l=list(format(n,'b'))
    
    for i in range(len(l)):
        if l[-i-1] == "1":
            print(2**i, end="???")
            
    print()

Python: while True:
    try:
        w = int(input())
    except:
        break
    print(*[2 ** i if w // 2 ** i else '' for i in range(10)])

Python: while True:
    try:
        w = int(raw_input())
        cu = [2**i for i in range(10)]
        all = 1023
        i = 9
        while all != w:
            if all > w:
                all -= cu[i]
                cu[i] = 0
                i -= 1
            if all < w:
                all = all + 2*cu[i] - cu[i]
                cu[i+1] = 2*cu[i]
                cu[i] = 0
                i -= 1
        for j in range(cu.count(0)):
            cu.remove(0)
        print (" ".join(map(str, cu)))
    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())
		ans = []
		i = 0
		while a > 0:
			if a & 1:
				ans.append(w[i])
			a >>= 1
			i += 1
		print(*ans)
	except EOFError:
		break

Python: from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

for line in stdin:
    try:
        w = int(line)
    except ValueError:
        break
    print(' '.join(str(1 << i) for i in xrange(10) if w & (1 << i)))

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

while True :
    try :
        c = -1
        left, right = int(input()), []
        while True :
            if left <= 0 : break
            else :
                if left - g[c] < 0 : c += -1
                else :
                    left -= g[c]
                    right.append(g[c])
        right.sort()
        print(*right)
    except : break

Python: while True:
    try:
        N=int(input())
        lis=[]
        while N!=1:
            lis.append(N%2)
            N=N//2
            if N==1:
                lis.append(N)
        num=0
        ans=""
        for i in lis:
            if i==1:
                ans +=str(2**num)+" "
            num +=1
        print(ans)
    except:break

Python: import sys
from itertools import compress


def solve(w):
    """ w[g]???????????¨???????????????????????????????????????
        ???????????? 1g????????? 2g????????? ??? 512g????????????????????????????????????????????????????????¢???
    """
    bin_w = '{0:010b}'.format(w)  # ?????????2?????°??¢??????(512g??????????????§???????????§???????????????0????????£?????°??????)
    result = [int(x) for x in bin_w]  # ??????????????????????????????????????°??????
    result.reverse()  # ???????????????????????¨???1g, 2g????????§?????????????????¨???????????????????????????????????????
    return result


if __name__ == '__main__':
    weights = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]  # ??????????????????

    # ??????????????\???
    for line in sys.stdin:
        w = int(line.strip())

        # ???????????????????±???????
        ans = solve(w)
        # print(ans)

        # ???????????????
        comp = compress(weights, ans)  # weights[]??????????????????ans[i]???1?????¨??????????????????
        print('{0}'.format(' '.join(map(str, comp))))

Python: while True:
    try:
        w = int(input())
    except:
        break
    ans = [2 ** i if w // 2 ** i % 2 else 0 for i in range(10)]
    while ans.count(0):
        del ans[ans.index(0)]
    print(*ans)

Python: import sys
f = sys.stdin

for line in f:
    target = int(line)
    print(*[weight for weight in [2 ** i for i in range(10)] if target & weight])

Python: import sys
for d in sys.stdin:print(*[w for w in[2**i for i in range(10)]if int(d)& w])

Python: import sys

for line in sys.stdin:
    w_all = reversed([1, 2, 4, 8, 16, 32, 64, 128, 256, 512])
    n = int(line)
    use_w_list = []
    for w in w_all:
        if n >= w:
            n -= w
            use_w_list.append(w)
        if n == 0:
            break
    use_w_list = use_w_list[::-1]
    out = str(use_w_list[0])
    use_w_list.remove(use_w_list[0])
    for u in use_w_list:
        out += ' {0}'.format(str(u))
    print(out)

Python: def aux(x,ans,b):
    if x == 0:
        return(' '.join(map(str,ans)))
    elif x % 2 == 1:
        return(aux(x//2, ans+[b],b*2))
    else:
        return(aux(x//2, ans, b*2))

while True:
    try:
        x = int(input())
        print(aux(x,[],1))
    except EOFError:
        break

Python: import sys


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

Python: import sys
for d in sys.stdin:print(*[w for w in[2**i for i in range(10)]if int(d)&w])

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)
            weight = (weight - 1)/2
        counter += 1
    print(' '.join(map(str, weights_list)))


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