include[HTML_REMOVED]
using namespace std;
int main(){
std::ios::sync_with_stdio(0);
int n,m;
cin>>n>>m;
map[HTML_REMOVED]mp1;//对应几篇出现
map[HTML_REMOVED]mp2;//对应出现几次
for(int i=1;i<=n;i){//每篇文章
int t;
cin>>t;
int flag[m+5]={0};
for(int j=1;j<=t;j){
int temp;
cin>>temp;
if(flag[temp]==0){
mp1[temp];
flag[temp]=1;
}
mp2[temp];
}
}
for(int i=1;i<=m;i++){
cout<<mp1[i]<<’ ‘<<mp2[i]<<endl;
}
return 0;
}