#include using namespace std; using ll = long long; constexpr char newl = '\n'; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int t; cin >> t; for (int i = 0; i < t; i++) { ll a, b; cin >> a >> b; vector ans; while (true) { if ((a << 1) > b) break; ans.push_back(a); a <<= 1; if (a == b) break; } for (int j = 59; j >= 0; ) { if (!(b >> j & 1)) { --j; continue; } if (a >> j & 1) { --j; continue; } ll nex = min((a & -a), 1LL << j); ans.push_back(nex); a += nex; } cout << ans.size() << newl; for (int i = 0; i < ans.size(); i++) { cout << ans[i] << " \n"[i + 1 == ans.size()]; } } return 0; }