#include using namespace std; #include //using namespace atcoder; using ll = long long; using ull = unsigned long long; using i128 = __int128_t; using u128 = unsigned __int128_t; using mint = atcoder::static_modint<998244353>; const int mod = 998244353; #include mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count()); int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}; int dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; template bool chmin(T& a, const T& b){ if (b < a){ a = b; return true; } else { return false; } } template bool chmax(T& a, const T& b){ if (a < b){ a = b; return true; } else { return false; } } void solve(){ ll a, b; cin >> a >> b; int idx = 0; for (int i = 60; i >= 0; i--){ if ((b >> i) & 1){ idx = i; break; } } vector ans; for (int i = 0; i <= 60; i++){ if ((a >> i) & 1){ if (a + (1LL << i) <= b){ ans.push_back(1LL << i); a += (1LL << i); } } } while(a != b){ for (int i = 60; i >= 0; i--){ if (a + (1LL << i) <= b){ ans.push_back(1LL << i); a += (1LL << i); } } } cout << (int)ans.size() << '\n'; for (auto d : ans){ cout << d << ' '; } cout << '\n'; }; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while(t--){ cout << fixed << setprecision(15); solve(); } }