#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int q;     cin >> q;     while (q--) {       ll a, b, m;       cin >> a >> b >> m;       if (a == b) {         cout << 1 <<     << a <<   n ;         continue;       }       bool f = false;       for (int k = 1; k <= 49 && (1ll << (k - 1)) <= b / a; k++) {         ll t = (1ll << (k - 1)) * a;         ll b_tmp = b - t;         vector<ll> rs(k + 1);         rs[0] = a;         for (int cur = 1; cur <= k; cur++) {           ll pw = (cur == k) ? 1 : (1ll << (k - cur - 1));           rs[cur] = 1;           b_tmp -= pw * rs[cur];         }         if (b_tmp < 0) {           continue;         }         for (int cur = 1; cur <= k; cur++) {           ll pw = (cur == k) ? 1 : (1ll << (k - cur - 1));           ll now = min(m - 1, b_tmp / pw);           b_tmp -= pw * now;           rs[cur] += now;         }         if (b_tmp == 0) {           f = true;           cout << k + 1 <<    ;           vector<ll> ans;           for (int i = 0; i <= k; i++) {             ll cur = rs[i];             for (int j = i - 1; j >= 0; j--) {               cur += ans[j];             }             ans.push_back(cur);             cout << cur <<    ;           }           cout <<   n ;           break;         }       }       if (!f) cout << -1 <<   n ;     }     return 0;   }   