#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>m;
for(int k=0;k<m;k++){
cin>>n;int count[10]={0};
for(int i=1;i<=n;i++){
string s =to_string(i);
for(int j=0;j<s.size();j++)
count[s[j]-'0']++;
}
for(int i=0;i<10;i++)
if(i==0)cout<<count[i];
else cout<<" "<<count[i];
cout<<endl;
}
return 0;
}