#include #include using lint = long long; void solve() { lint x, y; std::cin >> x >> y; std::vector ans; while (x != y) { int r = 60; while (true) { if (((y >> r) & 1) && ((~x >> r) & 1)) break; --r; } int l; for (l = 0; l < r; ++l) { if ((x >> l) & 1) break; } ans.push_back(1LL << l); x += (1LL << l); } std::cout << ans.size() << "\n"; for (auto a : ans) std::cout << a << " "; std::cout << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int q; std::cin >> q; while (q--) solve(); return 0; }