#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, -1, 0, 1, -1, 0, 1};
int kx8[] = {1, 1, 2, 2, -1, -1, -2, -2};
int ky8[] = {2, -2, 1, -1, 2, -2, 1, -1};
long long poww(long long a, long long b) {
  if (b == 0) return 1;
  long long x = poww(a, b / 2);
  x = x * x;
  if (b % 2 == 1) x = (x * a);
  return x;
}
int frq[200000], a[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> v;
    for (int i = 0; i < (n); i++) {
      if (s[i] != '0') {
        long long now = poww(10, n - i - 1);
        long long x = s[i] - '0';
        v.push_back(now * x);
      }
    }
    cout << v.size() << endl;
    for (auto x : v) cout << x << " ";
    cout << endl;
  }
  return 0;
}
