Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		num, _ := strconv.Atoi(scanner.Text())
		first := true
		beki := 1
		for num != 0 {
			if num % 2 == 1 {
				if !first {
					fmt.Print(" ")
				}
				fmt.Print(beki)
				first = false
			}
			num /= 2
			beki *= 2
		}
		fmt.Println()
	}
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define all(c) (c).begin(), (c).end()

using namespace std;
template<class T> inline void chmax(T& a, T b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, T b) { if(b < a) a = b; }

int main() {
	int num[10] = {512,256,128,64,32,16,8,4,2,1};
	int N;

	while (cin >> N) {
		vector<int> ans;
		rep(i,10) {
			if (N >= num[i]) {
				ans.push_back(num[i]);
				N = N - num[i];
			}
		}
		reverse(all(ans));
		rep(i,ans.size()) {
			if (i == ans.size()-1) {
				cout << ans[i];
			}
			else {
				cout << ans[i] << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

C++: #include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int g;
    while (scanf("%d", &g) != EOF) {
        int f = 0;
        rep (i, 10) if (g&(1<<i)) {
            if (f) printf(" ");
            f = 1;
            printf("%d", 1<<i);
        }
        printf("\n");
    }
    return 0;
}

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

int main()
{
    int n;
	int w[10]={1,2,4,8,16,32,64,128,256,512};
	while(1){
		cin >> n;
		if(cin.eof()){break;}
		int	flag[10]={0};
	
		for(int i=9 ; i>=0; i--){
			if(n>=w[i]){
				n-=w[i];
				flag[i]++;
			}
		}
		for(int i=0; i<10 ; i++){
			if(flag[i]!=0){
				cout << w[i] <<" ";
			}
		}
		cout << endl;
	}
	
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
 
int main()
{
    int n;
    while(1){
	cin>>n;
	if(cin.eof()) break;
	vector <int> a;
	while(n>1){
		a.push_back(n%2);
		n=n/2;
	}
	a.push_back(n);
	for(int i=0;i<a.size();i++){
		if(a[i]*pow(2,i)==0) continue;
		cout<<a[i]*pow(2,i)<<" ";
	}
	cout<<endl;
    }
    return 0;
}

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

int main(void){
  int x;

  while(cin>>x){
    bool firstFlg = true;
    int pow = 1;

    while(x != 0){
      if(x % 2 == 1){
        if(firstFlg) firstFlg = false;
        else cout<<" ";
        cout<<pow;
      }

      x /= 2;
      pow *= 2;
    }

    cout<<endl;
  }

  return 0;
}

C++: #include<bits//stdc++.h>
using namespace std;

int main(){
int n;
while(cin>>n)
{
	if(n%2==1){
		cout<<"1 ";
		n-=1;
		}
		
	if(n%4==2){
		cout<<"2 ";
		n-=2;
		}	
		
	if(n%8==4){
		cout<<"4 ";
		n-=4;
		}	
		
	if(n%16==8){
		cout<<"8 ";
		n-=8;
		}	
		
	if(n%32==16){
		cout<<"16 ";
		n-=16;
		}	
		
	if(n%64==32){
		cout<<"32 ";
		n-=32;
		}	
		
	if(n%128==64){
		cout<<"64 ";
		n-=64;
		}	
		
	if(n%256==128){
		cout<<"128 ";
		n-=128;
		}	
		
	if(n%512==256){
		cout<<"256 ";
		n-=256;
		}	
		
	if(n%1024==512){
		cout<<"512 ";
		n-=512;
		}	
		cout<<'\n';
	}
	return 0;
		}

C++: #include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to) 
int main() {
	int n;
	while(cin >> n) {
		vector<int> v;
		rep(i,10) {
			if(1<<i & n) v.push_back(1<<i);
		}
		cout << v[0];
		rep2(i,1,v.size()) {
			cout << " " << v[i];
		}
		cout << endl;
	}
	return 0;
}

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

int main(){

  int weight;
  int n;

  while(cin>>weight,weight){
    vector<int> result;
    while(1){
      if(weight == 1 || weight ==2 || weight ==4 || weight ==8 || weight ==16 || weight ==32 || weight ==64 || weight ==128 || weight ==256 || weight ==512){
	result.push_back(weight);
	break;
      }
      if(weight<4)
	n=2;
      else if(weight<8)
	n=4;
      else if(weight<16)
	n=8;
      else if(weight<32)
	n=16;
      else if(weight<64)
	n=32;
      else if(weight<128)
	n=64;
      else if(weight<256)
	n=128;
      else if(weight<512)
	n=256;

      result.push_back(n);
      weight-=n;
    }

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

    for(auto i:result)
      cout<<i<<" ";
    cout<<endl;
  }
}

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

int main(){
	unsigned o;

	while ( cin >> o ){
		for ( int i = 0; i < 10; ++i ){
			if ( o & 1 << i ){
				cout << ( 1 << i );
				if ( !( i == 9 ) ){
					cout << " ";
				}
			}
		}
		cout << endl;
	}
}

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

int main(){

  int weight;
  int n;

  while(cin>>weight,weight){
    vector<int> result;
    while(1){
      if(weight == 1 || weight ==2 || weight ==4 || weight ==8 || weight ==16 || weight ==32 || weight ==64 || weight ==128 || weight ==256 || weight ==512){
	result.push_back(weight);
	break;
      }
     
      n=weight/2+weight%2;

      result.push_back(n);
      weight-=n;
    }

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

    for(auto i:result)
      cout<<i<<" ";
    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 <bits/stdc++.h>

using namespace std;

int main()
{
    int w;
    while (cin >> w) {
        vector<int> v;
        for (int i = 8; i >= 0; i--) {
            while ((1<<i) <= w) {
                w -= (1<<i);
                v.push_back(1<<i);
            }
        }
        sort(v.begin(), v.end());
        for (int i = 0; i < (int)v.size(); i++) {
            if (i > 0) cout << " ";
            cout << v[i];
        }
        cout << endl;
    }
    return 0;
}

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

int main() {
  int n,i;
  while(cin >> n) {
	  for (i=1; i<513; i*=2) if ((n & i) !=0) cout << i << ' ';
	  cout << endl;
  }
  return 0;
}