#include <bits/stdc++.h>
using namespace std;
long long int check(long long int n) {
  long long int r = 0, i = 0;
  if (n != 0) {
    while (1) {
      r = n % 10;
      if (r != 0) break;
      if (r == 0) {
        i++;
        n /= 10;
      }
    }
    r = r * pow(10, i);
  }
  return r;
}
long long int len(long long int n) {
  long long int l = 0;
  if (n != 0)
    while (n != 0) {
      if (n % 10 != 0) l++;
      n /= 10;
    }
  return l;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, l = 0, t;
  cin >> t;
  while (t--) {
    cin >> n;
    if (n == 0)
      cout << 1 << "\n" << 0 << "\n";
    else {
      cout << len(n) << "\n";
      while (n != 0) {
        cout << check(n) << " ";
        n = n - check(n);
        l++;
      }
    }
    cout << "\n";
  }
}
