#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  vector<int> v(t);
  for (int i = 0; i < (int)(t); i++) cin >> v[i];
  for (int x : v) {
    vector<int> tmp;
    int d = 10;
    while (x) {
      int rm = x % d;
      if (rm) tmp.push_back(rm);
      x -= rm;
      d *= 10;
    }
    cout << tmp.size() << endl;
    for (int ans : tmp) {
      cout << ans << " ";
    }
    cout << endl;
  }
}
