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++: //0031
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

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

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl;
#define CIN(x) cin>>(x);

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

int main(){

	int w;
	while (1){
		stack <int> st;
		CIN(w)
		for (int i = 10; i >= 0; i--){
			if (w >= weight[i]) {
				st.push(weight[i]);
				w -= weight[i];
			}
		}

		while (st.top()!=0){
			cout << st.top();
			st.pop();
			if (st.size() != 0) cout << " ";
		}
		cout << endl;
	}

	return 0;

}

C++: #include <iostream>
using namespace std;
int main(){
  int w[10]={1,2,4,8,16,32,64,128,256,512};
  int n;
  while(cin>>n){
    for(int i=0;n>0;n/=2,i++)
      if (n%2) cout<<w[i]<<" ";
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <map>
#include <sstream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

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

C++: //#define _USE_MATH_DEFINES
//#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>
//#include <map>

using namespace std;


int main(){

	int m, buf;

	while (cin >> m){
		buf = 1;

		for (int i = 0; i < 10; i++){
			if (m % 2 == 1) cout << buf << " ";
			m >>= 1;
			buf *= 2;
		}
		cout << endl;

	}

	return 0;
}

C++: #include <cstdio>
int main(){int n,s;while(scanf("%d",&n)){for(s=1;n;s*=2){n&s&&printf("%d%c",s,n-s?32:10);n-=n&s;}}}

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

int main(void){
	int omori[10]={1,2,4,8,16,32,64,128,256,512},a;
	stack<int> st; 
	int kari;
	while(cin>>a){
		for(int i=9; 0<=i; i--)
		{
			if(a-omori[i]>-1)
			{
				st.push(omori[i]);
				a=a-omori[i];
			}
		}
		while(1)
		{
			if (st.empty())break;
			cout << st.top()<<" ";
			st.pop();
		}
		cout<<endl;
	}
	return 0;
}

C++: //0031
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

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

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl;
#define CIN(x) cin>>(x);

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

int main(){

	int w;
	while (1){
		stack <int> st;
		CIN(w)
		for (int i = 10; i >= 0; i--){
			if (w >= weight[i]) {
				st.push(weight[i]);
				w -= weight[i];
			}
		}

		while (st.top()!=0){
			cout << st.top();
			st.pop();
			if (st.size()  > 1) cout << " ";
		}
		cout << endl;
	}

	return 0;

}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int W;
	int C[10]={1,2,4,8,16,32,64,128,256,512};
	while(cin>>W){
		int V=W;
		int digit=0,output=0;
		while(V){
			if(V&1){
				if(output++) cout << ' ';
				cout << C[digit];
			}
			V>>=1;
			digit++;
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
int n;
vector<int>v;
while(cin>>n)
{
	if(n%2==1){
		n-=1;
		v.push_back(1);
		}
		
	if(n%4==2){
		n-=2;
		v.push_back(2);
		}	
		
	if(n%8==4){
		n-=4;
		v.push_back(4);
		}	
		
	if(n%16==8){
		n-=8;
		v.push_back(8);
		}	
		
	if(n%32==16){
		n-=16;
		v.push_back(16);
		}	
		
	if(n%64==32){
		n-=32;
		v.push_back(32);
		}	
		
	if(n%128==64){
		n-=64;
		v.push_back(64);
		}	
		
	if(n%256==128){
		n-=128;
		v.push_back(128);
		}	
		
	if(n%512==256){
		n-=256;
		v.push_back(256);
		}	
		
	if(n%1024==512){
		n-=512;
		v.push_back(512);
		}	
		int a=v.size();
		for(int i=0;i<a;i++){
			cout<<v[i];
			if(i==a-1){
				cout<<endl;
				}
			else{
				cout<<" ";
				}	
			}
			v.erase(v.begin(),v.end());
	}
	return 0;
		}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){
	int n;
	while(cin >> n){
		bool flag = true;
		for(int i = 1; i <= 512; i *= 2){
			if(n & i){
				if(flag){
					cout << i;
					flag = false;
				}
				else cout << " " << i;
			}
		}
		cout << endl;
	}
	return 0;
}

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 ) << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

C++: import std.stdio;
import std.array;
import std.conv;
import std.algorithm;
import std.math;
void main() {
	string s;
	while( (s=readln()).length != 0 ){
		string[] input = split(s);
		int a = to!int(input[0]);
		for(int i=0;i<10;i++){
			if(a%2==1) write(pow(2,i)," ");
			a/=2;
		}
			writeln();
	}
}

C++: #include <iostream>

using namespace std;
int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
void solve()
{
	int a;
	while(cin >> a)
	{
		bool flag[10];
		memset(flag, 0, sizeof(bool)  * 10);
		for(int i = 9; i >= 0; --i)
		{
			if(a / weight[i])
			{
				flag[i] = true;
			}
			a %= weight[i];
		}
		for(int i = 0; i < 9; ++i)
		{
			if(flag[i])
			{
				cout << weight[i] << " ";
			}
		}
		if(flag[9])
		{
			cout << weight[9];
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}