#include <bits/stdc++.h>
using namespace std;
void print(vector<long long int> v) {
  for (auto ele : v) cout << ele << " ";
  cout << endl;
}
void print(long long int x) { cout << x << endl; }
void print(long long int x, long long int y) { cout << x << ", " << y << endl; }
int main() {
  long long int tcases;
  cin >> tcases;
  while (tcases--) {
    long long int number;
    cin >> number;
    long long int n = number, p = 10;
    vector<long long int> ans;
    while (n) {
      ans.push_back(n % p);
      n /= p;
    }
    long long int f = 1;
    for (long long int i = 0; i < ans.size(); i++) {
      ans[i] *= f;
      f *= 10;
    }
    vector<long long int> v;
    long long int cnt = 0;
    for (auto ele : ans) {
      if (ele) {
        v.push_back(ele);
        cnt++;
      }
    }
    print(cnt);
    print(v);
  }
}
