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
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const LL INF = 1e18;

int g[]={1,2,4,8,16,32,64,128,256,512};

int main(){
	int m;
	sort(g,g+9,greater<int>());
	while(cin>>m){
		vector<int>res;
		REP(i,9){
			if(m>=g[i]){
				m%=g[i];
				res.PB(g[i]);
			}
		}
		SORT(res);
		REP(i,SZ(res)){
			cout<<res[i];
			if(i!=SZ(res)-1)cout<<" ";
		}
		cout<<endl;
	}
	return 0;
}
/*

*/

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

using namespace std;

const int weight[10] ={1,2,4,8,16,32,64,128,256,512};

int main(void){
	int n;
	while(scanf("%d", &n) != EOF){
		stack<int> s;
		
		for(int i = 9; i >= 0; i--){
			if(n >= weight[i]){
				n-=weight[i];
				s.push(weight[i]);
			}
		}
		while(!s.empty()){
			printf("%d",s.top());
			s.pop();
			if(!s.empty())printf(" ");
		}
		puts("");
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int weight[10] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
	int n;
	while( cin >> n, n ){
		int j = 0;
		int ans[10];
		for( int i = 9; i >= 0; i-- ){
			if( n == 0 ) break;
			if( n >= weight[i] ){
				n -= weight[i];
				ans[j++] = weight[i];
			}
		}
		for( int i = j - 1; i >= 0; i-- ){
			if( i == 0 ){
				cout << endl;
				break;
			}
			cout << ans[i] << ' ';
		}
	}
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int n, tmp, *array, tmp2;
	
	while(cin >> n){
		array = (int *)calloc(10, sizeof(int));
		tmp2 = 0;
		while(n > 0){
			tmp = 1;
			while(n >= tmp){
				tmp *= 2;
			}
			tmp /= 2;
			array[tmp2++] = tmp;
			n -= tmp;
		}
		tmp2--;
		cout << array[tmp2];
		for(int i = tmp2 - 1; i >= 0; i--){
			cout << " " << array[i];
		}
		cout << endl;
		free(array);
	}
	
	return 0;
}

C++: #include<stdio.h>
int main(){
	int f[10]={1,2,4,8,16,32,64,128,256,512};
	int s[10]={0};
	int w,i,h=0;
	while(scanf("%d",&w)!=EOF){
		for(h=0,i=0;i<10;i++){s[i]=0;}
		for(i=0;i<10;i++){
			if(w>h){h+=f[i];s[i]=1;}
			if(w<h){h-=f[i-1];s[i-1]=0;}
			if(w==h){break;}
		}
		for(i=0;i<10;i++){
			if(s[i]==1){
				printf("%d ",f[i]);
			}
		}
		printf("\n");
	}
	return 0;
}

C++: #include <stdio.h>
int main(){
int n,temp;
bool f;
while(scanf("%d",&n)!=EOF){
temp=1;
f=true;
while(f){
if(n%(temp*2)!=0){
printf("%d",temp);
n-=temp;
f=false;
}
temp*=2;
}
while(n>0){
if(n%(temp*2)!=0){
printf(" %d",temp);
n-=temp;
}
temp*=2;
}
printf("\n");
}
}

C++: #include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int main()
{
	int nishin[] = {1,2,4,8,16,32,64,128,256,512};
	int n;
	vector<int> result;

	while(cin >> n) {
		result.clear();
		while(true) {
			if(n<=0) break;
			if(n%2 == 1) result.push_back(1);
			else		 result.push_back(0);
			n /= 2;
		}
		for(int i=0;i<result.size();i++) 
			if(result[i] == 1) cout << pow(2,i) << ' ';
		cout << '\n';
	}

	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(void){
	int n;
	while(cin >> n){
		for (int i=0; i<10; i++){
			if (n%2==1){
				cout << (int)pow(2.0,i);
				n = (n-1)/2;
			}else{
				n = n/2;
			}
			if (n==0){
				cout << endl;
				break;
			}else{
				cout << " ";
			}
		}
	}



	return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int p2[10] = {512,256,128,64,32,16,8,4,2,1},n;
  vector<int> v;
  while(cin>>n){
    for(int i=0;i<10;i++){
      if(n>=p2[i])n-=p2[i],v.push_back(p2[i]);
    }
    sort(v.begin(),v.end());
    vector<int>::iterator it=v.begin();
    for(;it!=v.end();it++){
      cout<<*it;
      (it==v.end())?cout<<endl:cout<<" ";
    }
    cout<<endl;
    v.clear();
  }
  return 0;
}

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

int main ()
{
  int a[10];
  int n;

  while (cin >> n){
    for (int i = 0; i <= 9; i++){
      a[i] = 0;
    }

    for (int i = 9; i >= 0; i--){
      if (n >= pow(2, i)){
        n -= pow(2, i);
        a[i]++;
      }
    }
    for (int i = 0; i <= 9; i++){
      if (a[i] == 1){
        cout << (int)pow(2, i);
        for (int j = i + 1; j <= 9; j++){
          if (a[j] == 1){
            cout << " " << (int)pow(2, j);
          }
        }
        cout << endl;
        break;
      }
    }
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#include <cmath>

#define _USE_MATH_DEFINES
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define INF 999999999
#define atcoder 1000000007
#define MAX_N 100

using namespace std;

int V[10] = { 1,2,4,8,16,32,64,128,256,512 };
bool judge[10] = { false };

int main() {

	int n;

	while (cin >> n && n!= EOF) {
		REPR(i,9) {
			if (n >= V[i]) {
				judge[i] = true;
				n -= V[i];
			}
			if (n == 0)
				break;
		}

		REP(i,10) {
			if (judge[i] == true)cout << V[i] << ' ';
			judge[i] = false;
		}
		cout << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(){
    int a;
    while(~scanf("%d",&a)){
        for(int i=0;i<10;i++)if(1<<i&a)printf(1<<i+1>a?"%d":"%d ",1<<i);
        printf("\n");
    }
}

C++: #include<iostream>

using namespace std;

int main()
{
	int weight;
	int i,j;
	int ans[10];
	
	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(ans[0]==1)
			cout << "1" ;
		
		for(i=1,j=2;i<10;i++,j*=2)
			if(ans[i]==1)
				cout << " " << j ;
				
	}
}