#include using namespace std; typedef long long int ll; typedef unsigned long long int ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } const ll MX=1e18; void print_res(vector res){ printf("%d\n",res.size()); for(ll p:res){ printf("%lld ",p); } printf("\n"); } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int q; cin >> q; while(q--){ ll a,b; cin >> a >> b; // a=myRand(MX); b=myRand(MX); if(a>b)swap(a,b); vector res; ll p=1; while(b-a>0 and res.size()<120){ while(a%p==0)p*=2; p/=2; if(b-a>=p){ a+=p; res.push_back(p); } else{ while(1){ if((b-a)&p){ a+=p; res.push_back(p); break; } else{ p/=2; } } } } assert(a==b); assert(res.size()<=120); print_res(res); } }