#include using namespace std; #define ll long long #define ld long double #define rep(i, n) for(int i = 0; i < (int)(n); i ++) #define rrep(i, n) for(int i = (int)(n) - 1; i >= 0; i --) #define pii pair #define pll pair #define vi vector #define vll vector #define vpi vector #define vpll vector #define sll set #define spll set #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define mod 1000000007 #define mod2 998244353 #define inf 1000000000000000000 #define pi acos(-1) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define Sort(a) sort(a.begin(), a.end()) #define Rsort(a) sort(a.rbegin(), a.rend()) #define print(x) for(auto i : (x)) cout << i << " "; cout << endl templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b enum_divisors(long long N) { vector res; for (long long i = 1; i * i <= N; ++i) { if (N % i == 0) { res.push_back(i); // 重複しないならば i の相方である N/i も push if (N/i != i) res.push_back(N/i); } } // 小さい順に並び替える sort(res.begin(), res.end()); return res; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << setprecision(15) << fixed; ll t; cin >> t; rep(i, t) { ll a, b; cin >> a >> b; vll ans; while (1) { auto c = enum_divisors(a); ll d = b - a; ll left = upper_bound(all(c), d) - c.begin() - 1; if (c[left] > d) left--; ans.pb(c[left]); a += c[left]; if (a == b) break; } cout << ans.size() << endl; print(ans); } }