#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)1e5 + 5;
string check(char x, int n) {
  string it = "";
  it.push_back(x);
  string z = "";
  for (int i = 0; i < n; i++) {
    z = z + "0";
  }
  it = it + z;
  return it;
}
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    int x;
    int count = 0;
    vector<string> v;
    cin >> x;
    string it = to_string(x);
    int size = it.length();
    for (int i = 0; i < size; i++) {
      if (it[size - 1 - i] != '0') {
        string second = check(it[size - 1 - i], i);
        count++;
        v.push_back(second);
      }
    }
    reverse(v.begin(), v.end());
    cout << count << endl;
    for (auto& i : v) {
      cout << i << " ";
    }
    cout << endl;
  }
  return 0;
}
