#include <bits/stdc++.h>
using namespace std;
const int N = 20;
long long ans, n, t, b, c, x, y, mx;
pair<long long, long long> a[N];
string s;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    long long i = 0;
    while (n) {
      a[i].first = (n % 10);
      a[i].second = (x);
      if (a[i].first != 0) i++;
      n /= 10;
      x++;
    }
    cout << i << endl;
    x = i;
    for (int i = (0); i < (x); i += 1) {
      cout << a[i].first;
      for (int j = (0); j < (a[i].second); j += 1) cout << 0;
      cout << " ";
    }
    cout << endl;
    x = 0;
  }
}
