#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; using ull = unsigned long long; 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; } template T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; } //mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); constexpr long long INF = 1LL << 60; constexpr int inf = 1000000007; constexpr long long mod = 1000000007LL; //constexpr long long mod = 998244353; constexpr int MAX = 5000000; void solve() { ll a, b; cin >> a >> b; vector res; while (a * 2 <= b) { res.emplace_back(a); a += a; } while (a < b) { for (int bit = 0; bit < 62; bit++) { if (a % (1LL << bit) == 0) { if (a + a / (1LL << bit) <= b) { res.emplace_back(a / (1LL << bit)); a += a / (1LL << bit); break; } } else { for (int i = bit - 1; i >= 0; i--) { if (a + (1LL << (i)) <= b) { res.emplace_back((1LL << (i))); a += (1LL << i); break; } } break; } } } cout << res.size() << "\n"; for (int i = 0; i < res.size(); i++) cout << res[i] << " \n"[i + 1 == res.size()]; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int kkt; cin >> kkt; while (kkt--) solve(); }