#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, l, a, b, c, d;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l;
    if (l == 10000) {
      cout << 1 << endl << 10000 << endl;
      continue;
    }
    a = l / 1000;
    b = (l - a * 1000) / 100;
    c = (l - a * 1000 - b * 100) / 10;
    d = l % 10;
    cout << (a > 0) + (b > 0) + (c > 0) + (d > 0) << endl;
    if (a > 0) cout << a * 1000 << " ";
    if (b > 0) cout << b * 100 << " ";
    if (c > 0) cout << c * 10 << ' ';
    if (d > 0) cout << d;
    cout << endl;
  }
  return 0;
}
