#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int len = log10(n) + 1;
    if (len == 1)
      cout << 1 << endl << n << endl;
    else {
      vector<int> v;
      while (n != 0) {
        if (n % int(pow(10, len)) == 0) {
          v.push_back(n);
          break;
        } else {
          v.push_back(n % 10);
          n /= 10;
          len--;
        }
      }
      int count = 0;
      for (int i = 0; i < v.size(); i++)
        if (v[i] != 0) count++;
      cout << count << endl;
      for (int i = v.size() - 1; i >= 0; i--) {
        if (v[i] != 0) {
          cout << v[i] * pow(10, i) << " ";
        }
      }
      cout << endl;
    }
  }
  return 0;
}
