#define _USE_MATH_DEFINES #include using namespace std; signed main() { auto solve = [&] () { vector ans; long long a, b; cin >> a >> b; for (int i = 0; i < 60; i++) { long long x = 1LL << i; long long y = 1LL << (i + 1); if (a % y != 0 && (a + x) <= b) { a += x; ans.push_back(x); } } for (int i = 59; i >= 0; i--) { long long x = 1LL << i; if (a + x <= b) { a += x; ans.push_back(x); } } assert(a == b); cout << ans.size() << '\n'; for (int i = 0; i < (int) ans.size(); i++) { if (i > 0) cout << " "; cout << ans[i]; } cout << '\n'; }; int t; cin >> t; while (t--) solve(); return 0; }