#include #define rep(a,n) for (ll a = 0; a < (n); ++a) using namespace std; //using namespace atcoder; using ll = long long; typedef pair P; typedef pair PP; typedef vector > Graph; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const ll INF = 1e18; #define debug(v) cout<<#v<<": ",prt(v); template inline void prt(pair p){cout<<"("< inline void prt(tuple p){cout<<"("<(p)<<", "<(p)<<", "<(p)<<")\n";} inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';} template inline void prt(vector v){cout<<'{';for(ll i=0;i inline void prt(vector >& vv){ for(const auto& v : vv){ prt(v); } } template inline void prt(deque v){cout<<'{';for(ll i=0;i inline void prt(map v){cout<<'{';ll c=0;for(auto &p: v){cout< inline void prt(unordered_map v){cout<<'{';ll c=0;for(auto &p: v){cout< inline void prt(set v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';} template inline void prt(multiset v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';} void solve(ll a,ll b){ vectorans; ll f = a; while(a!=b){ if(a*a<=b){ ans.push_back(a); a *= 2; } else{ ll tmp = a; while(a+tmp>b){ if(tmp%2!=0)break; tmp /= 2; } if(a+tmp<=b){ ans.push_back(tmp); a += tmp; } /* else{ for(int i=2;i<=a;i++){ if(a%i!=0)continue; ll now = a/i; if(a+now<=b){ a += now; ans.push_back(now); break; } } } */ else{ for(int i=min(b-a,a);i>=1;i--){ if(a%i!=0)continue; ll now = i; if(a+now<=b){ a += now; ans.push_back(now); break; } } } } } cout << ans.size() << endl; rep(i,ans.size()-1){ cout << ans[i] << ' '; } cout << ans[ans.size()-1] << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); //input ll t; cin >> t; rep(test,t){ ll a,b; cin >> a >> b; solve(a,b); } return 0; }