#include <iostream>
using namespace std;
int main() {
int d;
cin >> d;
for (int j = 0; j < d; ++j){
int n;
bool w = false;
cin >> n;
for (int i = 0; n>0; ++i){
if (n % 2 == 1){
if(w) cout << " ";
w = true;
cout << i;
}
n /= 2;
}
cout << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgZDsKCWNpbiA+PiBkOwoJZm9yIChpbnQgaiA9IDA7IGogPCBkOyArK2opewoJCWludCBuOwoJCWJvb2wgdyA9IGZhbHNlOwoJCWNpbiA+PiBuOwoJCWZvciAoaW50IGkgPSAwOyBuPjA7ICsraSl7CgkJCWlmIChuICUgMiA9PSAxKXsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHcpIGNvdXQgPDwgIiAiOwoJCQkJCQkJdyA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3V0IDw8IGk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KCQkJbiAvPSAyOwoJCX0KCQljb3V0IDw8IGVuZGw7Cgl9CglyZXR1cm4gMDsKfQ==