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>
#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;
}

C++: #include<iostream>
#include<bitset>
#include<cmath>
using namespace std;
int main(){
	int weight;
	while(cin>>weight){
		bitset<10> num(weight);
		int i;
		for(i=0;num[i]==0;++i);
		cout<<pow(2.0,i);
		for(++i;i<10;++i){
			if(num[i]==1)cout<<' '<<pow(2.0,i);
		}
		cout<<endl;
	}
}

C++: #include <stdio.h>
int main() {int N;while (scanf("%d",&N)!=EOF) {int i=0,j=1;while (N) {if (N&1) {if (i) printf(" ");printf("%d",j);i++;} N>>=1,j<<=1;} puts("");}return 0;}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int data[10];
	data[0] = 1;
	for(int i = 1; i < 10; ++i){
		data[i] = data[i - 1] * 2;
	}

	int n;
	while(cin >> n){

		bool check[10];
		for(int i = 0; i < 10; ++i){
			check[i] = false;
		}

		for(int i = 9; i >= 0; --i){
			if(n >= data[i]){
				n -= data[i];
				check[i] = true;
			}
		}

		bool check2 = false;
		for(int i = 0; i < 10; ++i){
			if(check[i]){
				if(check2) cout << " ";
				else check2 = true;
				cout << data[i];
			}
		}

		cout << endl;

	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 1000000;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/




int main()
{
	int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	int n;
	set<int> weights;
	
	
	while (cin >> n)
	{
		for (int i=9; i>=0; i--)
		{
			if (n >= weight[i])
			{
				weights.insert(weight[i]);
				n -= weight[i];
			}
		}
		bool first_flag = true;
		set<int>::iterator it = weights.begin();
		while (it != weights.end())
		{
			if (first_flag)
			{
				cout << *it;
				first_flag = false;
			} else {
				cout << " " << *it;
			}
			it++;
		}
		cout << endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
	int n;
	int list[11];
	int size;
	while(cin >>n,!cin.eof()){
		int i=1,size=0;
		if(i&n)
			list[size++]=i;
		i <<=1;
		while(i<=n){
			if(i&n)
				list[size++]=i;
 			i <<=1;
		}
		for(i=0;i<size;i++)
			cout << (i?" ":"")  << list[i];
		cout << endl;
	}
	return 0;
}