#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    int count = 1, x = 0;
    vector<int> v;
    while (n != 0) {
      v.push_back((n % 10) * count);
      if ((n % 10) * count) x++;
      n /= 10;
      count *= 10;
    }
    printf("%d \n", x);
    for (int i = 0; i < v.size(); i++) {
      if (v[i] != 0) printf("%d ", v[i]);
    }
    printf("\n");
  }
  return 0;
}
