#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> child_node[100];
int leaf_nodes[100] = {0};
int maxDepth = -1;
void dfs(int n, int depth) {
if(child_node[n].size() == 0) {
leaf_nodes[depth]++;
maxDepth = max(maxDepth, depth);
return;
}
for(int i = 0; i < child_node[n].size(); ++i) {
dfs(child_node[n][i], depth+1);
}
}
int main(void) {
int n, m;
int node, k, tmp;
cin >> n >> m;
for(int i = 0; i < m; ++i) {
cin >> node >> k;
for(int j = 0; j < k ;++j) {
cin >> tmp;
child_node[node].push_back(tmp);
}
}
dfs(1, 0);
cout << leaf_nodes[0];
for(int i = 1; i <= maxDepth; ++i) {
cout << ' ' << leaf_nodes[i];
}
return 0;
}