#include <iostream>
#include <vector>
#include <climits>
#include <cstring>
using namespace std;
vector<int> vector1[105];//代表某个节点的叶子节点
int nums[105];//代表每一层的叶子节点的个数
int maxDepth=INT_MIN;
void dfs(int id, int depth){
if (vector1[id].empty()){
nums[depth]++;
maxDepth=max(maxDepth,depth);
return;
}
for (int x:vector1[id]){
dfs(x,depth+1);
}
}
int main() {
int n,m;
cin>>n>>m;
memset(nums,0, sizeof(nums));
for (int i = 0; i < m; ++i) {
int id,k;
cin>>id>>k;
for (int j = 0; j < k; ++j) {
int child;
cin>>child;
vector1[id].push_back(child);
}
}
dfs(1,0);
cout<<nums[0];
for (int l = 1; l <= maxDepth; ++l) {
cout<<" "<< nums[l];
}
return 0;
}