#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} fast_ios_;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < (int)(t); ++i) {
    int n;
    cin >> n;
    int d = 0;
    vector<int> ls;
    while (n != 0) {
      int a = n % 10;
      if (a != 0) {
        ls.push_back(a * pow(10, d));
      }
      n /= 10;
      d++;
    }
    cout << ls.size() << endl;
    reverse(ls.begin(), ls.end());
    for (int j = 0; j < (int)(ls.size()); ++j) {
      cout << ls[j];
      if (j - 1 != ls.size()) {
        cout << " ";
      }
    }
    cout << endl;
  }
  return 0;
}
