#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T{};
  cin >> T;
  for (int t = 0; t < T; t++) {
    int N{};
    cin >> N;
    int x{};
    vector<int> v{};
    while (N != 0) {
      x = N % 10;
      v.push_back(x);
      N = N / 10;
    }
    int count{};
    for (int i = 0; i < v.size(); i++) {
      if (v[i] != 0) count++;
    }
    cout << count << "\n";
    for (int i = 0; i < v.size(); i++) {
      if (v[i] != 0) {
        cout << v.at(i);
        for (int j = 0; j < i; j++) cout << "0";
        cout << " ";
      }
    }
    cout << "\n";
  }
  return 0;
}
