#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    int l = 0;
    int z = 0;
    cin >> n;
    int num = n;
    int r = 1;
    if (n >= 1 && n <= 9) {
      cout << "1" << '\n';
      cout << n << '\n';
    } else {
      while (num != 0) {
        if (num % 10 == 0) {
          z++;
        }
        num = num / 10;
        l++;
      }
      if (l - z == 1) {
        cout << "1" << '\n';
        cout << n << '\n';
      } else {
        cout << l - z << '\n';
        while (n != 0) {
          if (n % 10 != 0) {
            cout << (n % 10) * r << " ";
          }
          r = r * 10;
          n = n / 10;
        }
        cout << '\n';
      }
    }
  }
  return 0;
}
