#include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int i = 0; i < n; ++i) #define rep1(i,n) for(int i = 1; i <= n; ++i) using namespace std; templatebool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; } templatebool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; } template inline int sz(T &a) { return a.size(); } using ll = long long; using ld = long double; using pi = pair; using pl = pair; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; const int inf = numeric_limits::max(); const ll infll = numeric_limits::max(); int main() { vl pow2(60); pow2[0] = 1; rep(i,59) { pow2[i+1] = pow2[i] * 2; } int t; cin >> t; while(t-- > 0) { ll a,b; cin >> a >> b; ll c = b; int cnt = 0; while(c > 0) { c /= 2; cnt++; } cnt--; int j = cnt; while(((a >> j) & (b >> j)) & 1) { j--; } int k = 0; while(!((a >> k) & 1)) { k++; } vl res; res.push_back(pow2[k]); for(int i = k; i < j; ++i) { if( !((a >> i) & 1) ) { res.push_back(pow2[i]); } } for(int i = j - 1; i >= 0; --i) { if( (b >> i) & 1) { res.push_back(pow2[i]); } } cout << sz(res) << "\n"; for(auto val: res) { cout << val << " "; } cout << "\n"; } return 0; }