#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)<<endl #define smax(x,y) (x)=max((x),(y)) #define smin(x,y) (x)=min((x),(y)) #define MEM(x,y) memset((x),(y),sizeof (x)) #define sz(x) (int)(x).size() #define RT return using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vll = vector<ll>; void solve() { int T; cin >> T; rep(ITER, T) { vll ans; ll A, B; cin >> A >> B; ll x = 1; while (A % (x * 2) == 0) { x *= 2; } while (A + x <= B) { ans.push_back(x); A += x; x *= 2; } while (A < B) { if (A + x <= B) { ans.push_back(x); A += x; } else { x /= 2; } } assert(A == B); cout << sz(ans) << endl; rep(i, sz(ans)) { cout << ans[i] << (i == sz(ans) - 1 ? '\n' : ' '); } } } int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); solve(); return 0; }