#include using namespace std; typedef long long ll; #define rep(i,N) for(int i=0;i i_i; typedef pair l_l; template using vec = vector; template using vvec = vector>; struct fast_ios{ fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } #define TOSTRING(x) string(#x) template istream &operator>>(istream &is, vector &vec) { for (T &x : vec) is >> x; return is; } template ostream &operator<<(ostream &os, const vector &v) { os << "["; for(auto _: v) os << _ << ", "; os << "]"; return os; }; template ostream &operator<<(ostream &os, set &st) { os << "("; for(auto _: st) { os << _ << ", "; } os << ")";return os;} template ostream &operator<<(ostream &os, const pair< T, U >& p){os << "{" < ostream &operator<<(ostream &os, const map &mp){ os << "["; for(auto _: mp){ os << _ << ", "; } os << "]" << endl; return os; } #define DUMPOUT cerr void dump_func(){ DUMPOUT << endl; } template void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); } #ifdef DEBUG #define dbg(...) dump_func(__VA_ARGS__) #define dump(...) DUMPOUT << string(#__VA_ARGS__) << ": "; dump_func(__VA_ARGS__) #else #define dbg(...) #define dump(...) #endif const int INF = (ll)1e9; const ll INFLL = (ll)1e18+1; const ll MOD = 1000000007; // const ll MOD = 998244353; const long double PI = acos(-1.0); /* const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const string dir = "DRUL"; */ void solve(){ ll A, B; cin >> A >> B; int top = 0; for(int i = 60; i >= 0; i--){ if((A & bit(i)) == 0 && ((B & bit(i)) > 0)){ top = i; break; } } dump(A, B, top); vector ans; while((A&bit(top)) == 0){ rep(i,top){ if(A&bit(i)){ A += bit(i); ans.emplace_back(bit(i)); break; } } } for(int i = top - 1; i >= 0; i--){ ll a = A & bit(i); ll b = B & bit(i); if(a == 0 && b > 0){ A += bit(i); ans.emplace_back(bit(i)); } } dump(A, B); cout << ans.size() << endl; for(auto a: ans){ cout << a << " "; } cout << endl; } int main(){ int t; cin >> t; while(t--)solve(); }