// #include "pch.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; typedef std::pair Pii; typedef std::pair Pll; typedef std::pair Pdd; #define rip(i, n, s) for (int i = (s);i < (int)( n ); i++) #define all(a) a.begin(), a.end() #define MM << " " << template using MaxHeap = std::priority_queue; template using MinHeap = std::priority_queue, std::greater>; template inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template void vdeb(std::vector &bb) { for (int i = 0;i < bb.size();i++) { if (i == bb.size() - 1) std::cout << bb[i]; else std::cout << bb[i] << ' '; } std::cout << '\n'; } template void vdeb(std::vector> &bb) { for (int i = 0;i < bb.size();i++) { std::cout << i << ' '; vdeb(bb[i]); } std::cout << '\n'; } using namespace std; void solve(vector &da){ ll a,b; cin >> a >> b; ll c = b-a, now = 1; while(a%now == 0) { now*=2; } now/=2; while(c) { if(c <= now) { while(c < now) { now /= 2; } da.push_back(now); c -= now; } else { da.push_back(now); c -= now; now *= 2; } } } int main() { int t; cin >> t; vector> da(t, vector(0)); rip(i,t,0) { solve(da[i]); } rip(i,t,0) { cout << da[i].size() << endl; vdeb(da[i]); } }