#include <iostream>
using namespace std;
int main()
{
int n, num, i;
cin >> n;
for (i=1; i<=n; i++){
cin >> num;
while(num != 0){
cout << num%10 << ' ';
num = num / 10;
}
cout << '\n';
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSAKewoJaW50IG4sIG51bSwgaTsKCWNpbiA+PiBuOwoJZm9yIChpPTE7IGk8PW47IGkrKyl7CgkJY2luID4+IG51bTsKCQl3aGlsZShudW0gIT0gMCl7CgkJCWNvdXQgPDwgbnVtJTEwIDw8ICcgJzsKCQkJbnVtID0gbnVtIC8gMTA7CgkJfQoJCWNvdXQgPDwgJ1xuJzsKCX0KCXJldHVybiAwOwp9