Title: Weight

Grandmother uses a balance scale. When the same weight is placed on both sides of the scale, it balances; otherwise, it tilts towards the heavier side. The weights of 10 weights are in ascending order: 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g.

Grandmother says, "I can measure in grams up to about 1kg." When asked to weigh the juice, she places the juice on the left side and 8g, 64g, and 128g weights on the right side. She then concludes, "The total weight of the weights is 200g, so the weight of the juice is 200g. How's that for accuracy?"

Create a program that, given the weight of an item to be placed on the left side, outputs the weights of the weights to be placed on the right side in ascending order. The weight of the item to be measured is at most the sum of all weights (1023g).

Input:
Multiple datasets are given. The weight of the item to be placed on the left side is given in a single line for each dataset. Process until the end of the input. The number of datasets does not exceed 50.

Output:
For each dataset, output the weights to be placed on the right side (in ascending order) separated by a single space on a single line.

Sample Input:
5
7
127

Output for the Sample Input:
1 4
1 2 4
1 2 4 8 16 32 64

Hint:
The weight of the weights is 2 to the power of n (n = 0, 1, .... 9) grams.

# Buggy version:
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()

# Fixed version:
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()

# Buggy version:
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))

# Fixed version:
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))

# Buggy version:
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

# Fixed version:
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

# Buggy version:
w_a = [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



# Fixed version:
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

# Buggy version:
def bin(w, l):
  if w == 0:
    return l
 
  l.append(w % 2)
  return bin(w // 2, l)
 
while True:
  try:
    w = int(input())
    w_bin = bin(w, [])
    ans = ""
    for i, v in enumerate(w_bin):
      if v:
        ans += str(2 ** i) + " "
    print(ans.rstrip())
 
  except EOFError:
    break


# Fixed version:
#2進数化
def bin(w, l):
  if w == 0:
    return l

  l.append(w % 2)
  return bin(w // 2, l)

while True:
  try:
    w = int(input())
    w_bin = bin(w, [])
    ans = ""
    for i, v in enumerate(w_bin):
      if v:
        ans += str(2 ** i) + " "
    print(ans.rstrip())

  except EOFError:
    break

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


# Fixed version:
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())))

# Buggy version:
# 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



# Fixed version:
# 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