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 <map>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef  long long LL;
typedef  vector<int> VI;
typedef  string STR;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MK make_pair
#define PB push_back
#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())
#define COUT(a) cout<<a<<endl
//-------------
//repetition
//-------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(c) REP(i,SZ(c))cerr<<#c<<i<<"="<<(c[i])<<endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const int MOD = 1000000007;
int main()
{
	int wheit[10] = { 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 };
	int a;
	while (cin >> a)
	{
		VI ANS;
		REP(i, 10)
		{
			if (a >= wheit[i])
			{
				a -= wheit[i];
				ANS.push_back(wheit[i]);
			}
		}
		REP(i, SZ(ANS))
		{
			if (i != SZ(ANS) - 1 || i == 0)
			{
				cout << ANS[SZ(ANS) - i];
			}
			else
			{
				cout << " ";
				cout << ANS[SZ(ANS) - i];
			}
		}
		cout << endl;
	}
#ifdef _DEBUG
	while (1);
#endif // _DEBUG

	return 0;
}

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

int main(){
	int n;
	while(cin >> n){
		int tmp = 0;
		vector<int> ans;
		for(int i = 9; i >= 0; i--){
			if(n - pow(2, i) >= 0){
				ans.push_back(pow(2, i));
				n -= pow(2, i);
			}
		}
		sort(ans.begin(), ans.end());
		for(int i = 0; i < ans.size() - 1; i++){
			cout << ans[i] << " ";
			tmp = i + 1;
		}
		cout << ans[tmp] << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;
  while(cin >> n){
	int flag = 1;
	for(int i = 0;i < 10;i++){	  
	  if((n & (1<<i)) && flag){
		flag = 0;
		cout << (1<<i);
	  }else if((n & (1<<i)) && !flag){
		cout << " " << (1<<i);
	  }


	}
	cout << endl;
  }
  return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<bool, int> P;

int a[10];
int v[1025][10];
int used[10];

void comv(int i, int s)
{
    if (i == 10)
    {
        rep(j, 10) v[s][j] = used[j];
        return;
    }

    used[i] = 0;
    comv(i + 1, s);
    used[i] = 1;
    comv(i + 1, s + a[i]);
}

int main()
{
    rep(i, 10)
        a[i] = pow(2, 9 - i);

    comv(0, 0);
    int n;
    while (cin >> n)
    {
        int t;
        for (int i = 9; i >= 0; i--)
            if (v[n][i] == 1)
                t = i;
        for (int i = 9; i >= 0; i--)
        {
            if (v[n][i] == 1)
                t != i ? cout << a[i] << " " : OP(a[i]);
        }
    }
    return 0;
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>
#include <set>

using namespace std;

double sq(double x){return x*x;}

int main(){
	int n;
	while(cin>>n){
		vector<int> ans;
		for (int i = 0; i < 10; i++)
		{
			if(n & (1 << i)) ans.push_back(1<<i);
		}
		for (int i = 0; i < (int)ans.size(); i++)
		{
			printf("%d%c",ans[i],(i == (int)ans.size()-1) ? '\n' : ' ');
		}
	}


	return 0;
}

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

using namespace std;

int main() {

    int i;
    int weight;

    while(cin >> weight) {
        i = 0;
        do {
            if(weight & 1) {
                cout << pow((double)2, (double)i);
                if(weight != 1) {
                    cout << ' ';
                }
            }
            i++;
        } while(weight >>= 1);
        cout << endl;
    }

}

C++: #include<iostream>
using namespace std;
int weights[10] = { 1,2,4,8,16,32,64,128,256,512 };
bool have[10] = { false,false,false,false,false,false,false,false,false,false };
int main() {
	int w;
	while (cin >> w) {
		int now = 0;
		int tmp = 0;
		for (int i = 0; i < 10; i++)have[i] = false;
		while (tmp < w) {
			tmp += weights[now];
			have[now] = true;
			now++;
		}
		while (tmp != w) {

			if (have[now]) {
				if (tmp - weights[now] >= w) {
					tmp -= weights[now];
					have[now] = false;
					now--;
				}
				else now--;
			}
			else {
				now--;
			}
		}
		int last;
		for (int i = 0; i < 10; i++)if (have[i])last = i;
		for (int i = 0; i < 10; i++) {
			if (have[i]) {
				if (i!=last)cout << weights[i] << ' ';
				else cout << weights[i];
			}
		}
		cout << endl;
	}
}

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

int main(){
  int n;
  while(cin >> n){
    int a = 1;
    bool first = true;
    while(true){
      if(n % 2  == 1){
	if(first) first = false;
	else cout << " ";
	cout << a;
      }
      a *= 2;
      n /= 2;
      if(n == 0) break;
    }
    cout << endl;
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,wei[10],ka=1,temp,ba[10];
  for(int i=0;i<10;i++){
    wei[i]=ka;
    ka*=2;
  }
   while(cin>>n){
    for(int i=0;i<10;i++){
      ba[i]=0;
    }
    for(int i=9;i>=0;i--){
      if(n!=0){
	if(n-wei[i]>=0){
	  n-=wei[i];
	  ba[i]=wei[i];
	}
      }if(n==0){
	break;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	cout<<ba[i]<<" ";
      }
    }
    cout<<endl;
  }
  return 0;
}

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

int main() {
    int n;
    while (cin>>n) {
        int f=0;
        for (int i=0;i<10;i++)
            if (n&1<<i) {
                if (f)
                    cout<<' ';
                cout<<(1<<i);
                f=1;
            }
        cout<<endl;
    }
    return 0;
}