#include <bits/stdc++.h>
#define int long long
#define re(a, b, c, d) for (auto a = b; a <= c; a += d)
#define de(a, b, c, d) for (auto a = b; a >= c; a -= d)
#define ms (a); memset (a, 0, sizeof a);
#define imax INT_MAX
#define imin INT_MIN
#define wh(a) while (a --)
#define PII pair <int, int>
#define F first
#define S second
#define pb push_back
#define eb emplace_back
template <typename T> bool chkmin (T &a, T b) {
return (b < a) ? a = b, 1 : 0;
}
template <typename T> bool chkmax (T &a, T b) {
return (b > a) ? a = b, 1 : 0;
}
using namespace std;
int T, n, x;
signed main () {
cout << fixed << setprecision (0);
ios :: sync_with_stdio (0), cin.tie (0), cout.tie (0);
cin >> T;
wh (T) {
cin >> x;
vector <int> v;
int l = 0, r = 10000;
while (x > 1) {
if (x & 1) v.pb (r --);
v.pb (l ++);
x >>= 1;
}
cout << v.size() << "\n";
for (auto t : v) cout << t << " ";
cout << "\n";
}
return 0;
}
1455A - Strange Functions | 1566B - MIN-MEX Cut |
678C - Joty and Chocolate | 1352E - Special Elements |
1520E - Arranging The Sheep | 1157E - Minimum Array |
1661D - Progressions Covering | 262A - Roma and Lucky Numbers |
1634B - Fortune Telling | 1358A - Park Lighting |
253C - Text Editor | 365B - The Fibonacci Segment |
75A - Life Without Zeros | 1519A - Red and Blue Beans |
466A - Cheap Travel | 659E - New Reform |
1385B - Restore the Permutation by Merger | 706A - Beru-taxi |
686A - Free Ice Cream | 1358D - The Best Vacation |
1620B - Triangles on a Rectangle | 999C - Alphabetic Removals |
1634C - OKEA | 1368C - Even Picture |
1505F - Math | 1473A - Replacing Elements |
959A - Mahmoud and Ehab and the even-odd game | 78B - Easter Eggs |
1455B - Jumps | 1225C - p-binary |