#include <stdio.h>
#include <string.h>
int counts[15] = {0};
void DigitCounting(int n);
int main() {
int T, n, first = 1;
scanf("%d", &T);
while (T--) {
scanf("%d", &n);
DigitCounting(n);
for (int i = 0; i < 10; i++) {
if (first) {
first = 0;
printf("%d", counts[i]);
}
else {
putchar(' ');
printf("%d", counts[i]);
}
}
putchar('\n');
memset(counts, 0, sizeof(counts));
first = 1;
}
return 0;
}
void DigitCounting(int n) {
int m;
for (int i = 1; i <= n; i++) {
m = i;
while (m) {
counts[m%10]++;
m /= 10;
}
}
}