// #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; auto solve = [&](int res)->optional>{ vector value(res); int rem = s;\ for(auto d = 7; d >= 0; -- d){ int i = 0; for(auto x: {8, 1}){ while(i < res && rem >= x * pow[d]){ value[i ++] += x * pow[d]; rem -= x * pow[d]; } } } return !rem ? value : optional>{}; }; for(auto res = 1; res <= 9; ++ res){ if(auto res_ptr = solve(res)){ cout << res << "\n"; ranges::copy(*res_ptr, ostream_iterator(cout, "\n")); return 0; } } assert(false); 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; } /* 70 18 11 11 10 10 10 */