#include <bits/stdc++.h>
using namespace std;
bool checkPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 1) return (power(a, b - 1) * a) % 1000000007;
  long long q = power(a, b / 2);
  return (q * q) % 1000000007;
}
bool CPT(long long n) { return !(n & (n - 1)); }
long long gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(int a, int b) { return (a / gcd(a, b)) * b; }
bool isSubsetSum(int set[], int n, int sum) {
  bool subset[n + 1][sum + 1];
  for (int i = 0; i <= n; i++) subset[i][0] = true;
  for (int i = 1; i <= sum; i++) subset[0][i] = false;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= sum; j++) {
      if (j < set[i - 1]) subset[i][j] = subset[i - 1][j];
      if (j >= set[i - 1])
        subset[i][j] = subset[i - 1][j] || subset[i - 1][j - set[i - 1]];
    }
  }
  return subset[n][sum];
}
bool compare(string a, string b) {
  string ab = a + b;
  string ba = b + a;
  return ab > ba;
}
int summands(int n) {
  long long c = 0;
  while (n > 0) {
    long long rem = n % 10;
    if (rem != 0) c++;
    n /= 10;
  }
  return c;
}
void solve() {
  long long n;
  cin >> n;
  long long i = 1;
  cout << summands(n) << "\n";
  while (n > 0) {
    long long rem = n % 10;
    if (rem * i != 0) cout << rem * i << " ";
    i *= 10;
    n /= 10;
  }
  cout << "\n";
}
int main() {
  int tt;
  cin >> tt;
  while (tt--) solve();
  return 0;
}
