// #pragma GCC target("avx2,bmi2,popcnt,lzcnt") // #pragma GCC optimize("O3,unroll-loops") #include // #include using namespace std; using namespace numbers; #ifdef LOCAL #include "Debug.h" #else #define debug_endl() 42 #define debug(...) 42 #define debug2(...) 42 #define debug_bin(...) 42 #endif // Returns the largest integer k with x >= k * y template T floor_div(T x, U y){ assert(y > 0); return x / y - (x % y < 0); } // Returns the smallest integer k with x <= k * y template T ceil_div(T x, U y){ assert(y > 0); return x / y + (x % y > 0); } template T &ctmin(T &x){ return x; } template T &ctmin(T &x, const Head &h, const Tail &... t){ return ctmin(x = min(x, h), t...); } template T &ctmax(T &x){ return x; } template T &ctmax(T &x, const Head &h, const Tail &... t){ return ctmax(x = max(x, h), t...); } int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); const int mx = 81181819; vector pow{1}; while((int)pow.size() < 9){ pow.push_back(pow.back() * 10); } auto solve_testcase = [&](auto testcase_id)->int{ int s; cin >> s, s = mx - s; vector> use(8); for(auto i = 7; i >= 0; -- i){ for(auto d: {8, 1}){ while(s >= d * pow[i]){ s -= d * pow[i]; use[i].push_back(d); } } } int cnt = ranges::max(use | views::transform([&](auto v){ return (int)v.size(); })); for(auto i = 0; i < 8; ++ i){ use[i].resize(cnt); } cout << cnt << "\n"; for(auto i = 0; i < cnt; ++ i){ int x = 0; for(auto j = 0; j < 8; ++ j){ x += use[j][i] * pow[j]; } cout << x << "\n"; } return 0; }; int testcase_count; cin >> testcase_count; for(auto testcase_id = 0; testcase_id < testcase_count; ++ testcase_id){ solve_testcase(testcase_id); } return 0; } /* 90 80 10 88 1 1 */