#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int ann[1000];
  for (int i = 1; i <= n; i++) {
    int cc = 0;
    int k;
    scanf("%d", &k);
    int cnt = 4;
    while (k) {
      int ans = 1;
      for (int j = 1; j < cnt; j++) ans *= 10;
      if (k / ans) {
        ann[++cc] = k / ans * ans;
      }
      cnt--;
      k = k % ans;
    }
    printf("%d\n", cc);
    while (cc--) {
      printf("%d%c", ann[cc + 1], cc == 0 ? '\n' : ' ');
    }
    memset(ann, 0, sizeof(ann));
  }
  return 0;
}
