#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for(int i = n-1; i >= 0; i--) #define all(x) (x).begin(),(x).end() // 昇順ソート #define rall(v) (v).rbegin(), (v).rend() // 降順ソート #define FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define sz(x) ((int)(x).size()) typedef long long ll; using P = pair; using VI = vector; using VVI = vector>; using VL = vector; using VVL = vector>; using VP = vector

; template void view(T e){std::cout << e << std::endl;} template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; } const int inf = 1 << 30; const ll INF = 1LL << 60; vector enumerate_num(ll x){ vector res; for(ll i = 1; i * i <= x; i++){ if (x % i == 0){ res.push_back(i); if (i * i != x) res.push_back(x / i); } } sort(all(res)); return res; } int main(){ int t; cin >> t; while(t--){ ll a, b; cin >> a >> b; VL ans; while(2*a <= b){ ans.push_back(a); a *= 2; } while(a != b){ if (a % 2 != 0){ a++; ans.push_back(1); continue; } ll tmpa = a; while(a + tmpa > b){ tmpa /= 2; } a += tmpa; ans.push_back(tmpa); } view(sz(ans)); rep(i,sz(ans)) printf("%lld%c", ans[i], i==sz(ans)-1? '\n' : ' '); } return 0; }