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)])
	}
}

C++: #include<iostream>
using namespace std;
int main()
{
int a;
int i[10][3];
i[0][2]=1;
i[1][2]=2;
i[2][2]=4;
i[3][2]=8;
i[4][2]=16;
i[5][2]=32;
i[6][2]=64;
i[7][2]=128;
i[8][2]=256;
i[9][2]=512;
while(cin>>a)
{
	for(int h=0;h<10;h++)
	{
		i[h][0]=0;
		i[h][1]=0;
	}
	for(i[0][0]=0;i[0][0]<=1;i[0][0]++)
	{
	for(i[1][0]=0;i[1][0]<=2;i[1][0]+=2)
	{
	for(i[2][0]=0;i[2][0]<=4;i[2][0]+=4)
	{
	for(i[3][0]=0;i[3][0]<=8;i[3][0]+=8)
	{
	for(i[4][0]=0;i[4][0]<=16;i[4][0]+=16)
	{
	for(i[5][0]=0;i[5][0]<=32;i[5][0]+=32)
	{
	for(i[6][0]=0;i[6][0]<=64;i[6][0]+=64)
	{
	for(i[7][0]=0;i[7][0]<=128;i[7][0]+=128)
	{
	for(i[8][0]=0;i[8][0]<=256;i[8][0]+=256)
	{
	for(i[9][0]=0;i[9][0]<=512;i[9][0]+=512)
	{
	if(i[0][0]+i[1][0]+i[2][0]+i[3][0]+i[4][0]+i[5][0]+i[6][0]+i[7][0]+i[8][0]+i[9][0]==a)
	{
	for(int j=0;j<10;j++)
	{
	if(i[j][0]!=0)
	{
	i[j][1]++;
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	int l=0;
	for(int k=0;k<10;k++)
	{
	if(l==0&&i[k][1]>0)
	{
	cout<<i[k][2];
	l++;
	}
	else if(i[k][1]>0)
	{
	cout<<" "<<i[k][2];
	}
	}
	cout<<endl;
}
return 0;
}

C++: #include<iostream>
#include<queue>
#define N 1 << 9
using namespace std;

int main(){
    int n;
    queue<int> qu;
    while(cin >>n){
        for(int i = 1; i <= N; i = i << 1){
            if((n & i) != 0){
                qu.push(i);
            }
        }
        while(qu.empty() != 1){
            cout <<qu.front();
            if(qu.size() != 1){
                cout <<" ";
            }
            qu.pop();
        }
        cout <<endl;
    }
    return 0;

}

C++: //53
#include<iostream>

using namespace std;

int main(){
  for(int n;cin>>n;){
    bool out=false;
    for(int i=0;i<=8;i++){
      if(n&1<<i){
	if(out){
	  cout<<' ';
	}
	out=true;
	cout<<(1<<i);
      }
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;

bool used[10], ans[10], endR;
int bundo[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

void init(){ for(int i = 0; i < 10; i++) used[i] = false; endR = false;}

void copyAns(){
  for(int i = 0; i < 10; i++) ans[i] = used[i];
}

void dfs(int i, int w){
  if(w == 0) { copyAns(); endR = true; return; }
  if(i == 10 || w < 0 || endR) return;

  if(!used[i]){
    used[i] = true;
    dfs(i + 1, w - bundo[i]);
  }
  used[i] = false;
  dfs(i + 1, w);
}

int main(void){
  int w;
  while(cin >> w){
    init();
    dfs(0, w);
    int cnt = 0;
    for(int i = 0; i < 10; i++){
      if(ans[i]) cnt++;
    }
    for(int i = 0; i < 10; i++){
      if(ans[i]) cout << bundo[i];
      if(ans[i] && --cnt) cout << " ";
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>

int main(int argc, const char * argv[])
{
    int cu[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
    int g, j = 0, cu2[10] = {0};
    scanf("%d", &g);
    
    for (int i = 0; i < 10; i++) {
        if ((g - cu[i]) < 0) {
            g -= cu [i - 1];
            cu2[j] = cu[i - 1];
            i = 0; j++;
        }
        if (g == 0) break;
    }
    for (int i = 0; i < j / 2; i++) {
        int tmp;
        tmp = cu2[j - 1 - i];
        cu2[j - 1 - i] = cu2[i];
        cu2[i] = tmp;
    }
    
    for (int i = 0; i < j; i++) {
        printf("%d ", cu2[i]);
    }
    puts("");
    
    return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int weight;
	int i,j;
	int ans[10];
	int flag;
	
	for(;cin >> weight;)
	{
		for(i=0;i<10;i++)
			ans[i]=0;
			
		for(i=0;weight>0;weight/=2,i++)
		{
			ans[i]=weight%2;
			if(weight%2==1)
				flag=i;
		}
		
		for(i=0,j=1;i<10;i++,j*=2)
		{
			if(ans[i]==1 && i<flag)
				cout << j << " " ;
			if(i==flag)
				cout << j ;
				
		}
		cout << endl;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int n, s;
int main() {
	while (cin >> n) {
		s = 0;
		for (int i = 0; i < 31; i++) {
			if (n % 2 == 1) {
				if (s) { cout << ' '; }
				cout << pow(2, i); s++;
				n -= 1;
			}
			n /= 2;
		}
		cout << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

void solve();

int main() {

   solve();

   return 0;

}

/*void solve() {＃３

   vector<int> S;
   vector<int> T;
   int n;   //Sの個数
   int q;   //Tの個数
   int ans=0;
   int buf;

   cin >> n;

   for (int i = 0; i < n; i++) {
      
      cin >> buf;
      S.push_back(buf);

   }

   cin >> q;

   for (int i = 0; i < q; i++) {

      cin >> buf;
      T.push_back(buf);

   }

   //Sをソート

   sort(S.begin(),S.end());

   for (vector<int>::iterator i=T.begin();i<T.end();i++){  //Tの各値をSから探す。あったらans＋＋

      if(binary_search(S.begin(),S.end(),*i)){ans++;}

   }

   cout << ans << endl;

}*/

void solve() {

   int in;
   vector<int> input;
   vector<string> ans;
   int w[10];
   int now=0; //今何問目？
   char c=' ';
   char buf[100]="";

   for (int i = 0; i < 10; i++) {

      w[i]=(int)pow(2,i);

   }

   while (cin >> in) {

      input.push_back(in);

   }


   for (vector<int>::iterator itr=input.begin();itr<input.end();itr++) {

      for (int i = 9; i >= 0; i--) {

         if (*itr >= w[i]) {

            *itr-=w[i];
            ans[now]+=to_string(w[i]);
            ans[now]+=c;
         }

         ans[now].pop_back();       //ここ2行で整形
         ans[now].push_back('\n');

      }

      now++;

   }

   for (vector<string>::iterator itr = ans.begin(); itr < ans.end(); itr++) {

      cout << *itr;

   }

}

C++: #include<iostream>
int main()
{
	auto powor_of_two = [](int n)
	{
		int result = 1;
		for (int i = 0; i < n; i++)
		{
			result *= 2;
		}
		return result;
	};
	for (int w; std::cin >> w;)
	{
		for (int i = 0; i < 10; i++)
		{
			int bit = w & 1;
			if (bit == 1)
			{
				std::cout << powor_of_two(i);
				w >>= 1;
				if (w != 0)
				{
					std::cout << ' ';
				}
				else
				{
					std::cout << std::endl;
					break;
				}
			}
			else
			{
				w >>= 1;
			}
		}
	}
	return 0;
}