#include using namespace std; using lint = long long; constexpr lint inf = 1LL << 60; constexpr lint mod = 1000000007; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int t; cin >> t; vector a(t), b(t); for (int i = 0; i < t; ++i) { cin >> a[i] >> b[i]; } for (int i = 0; i < t; ++i) { int nb = 64 - __builtin_clzll(b[i]); int tp = -1; lint curr = a[i]; vector res; for (int j = nb - 1; j >= 0; --j) { if ((b[i] & 1LL << j) && !(a[i] & 1LL << j)) { tp = j; break; } } // assert(tp != -1); for (int j = 0; j < tp; ++j) { if (a[i] & 1LL << j) { a[i] += 1LL << j; res.push_back(1LL << j); } } if (!(a[i] & 1LL << tp)) { a[i] += 1LL << tp; res.push_back(1LL << tp); } for (int j = tp - 1; j >= 0; --j) { if ((b[i] & 1LL << j) && !(a[i] & 1LL << j)) { a[i] += 1LL << j; res.push_back(1LL << j); } } cout << res.size() << "\n"; for (auto &r : res) { cout << r << " "; assert(curr % r == 0); curr += r; } assert(curr == b[i]); cout << endl; } return 0; }