#include<vector>#include<iostream>#include<algorithm>#include<unordered_map>#include<set>#include<map>usingnamespace std;intmain(){
unordered_map<int, vector<string>>Class;int n, m, a, j;scanf("%d %d",&n,&m);for(int i =0; i < n; i++){
string name;
cin >> name >> a;for(int i =0; i < a; i++){scanf("%d",&j);
Class[j].push_back(name);}}for(int i =1; i <= m; i++){sort(Class[i].begin(), Class[i].end());printf("%d %d
", i, Class[i].size());for(auto it : Class[i]){printf("%s
", it.c_str());}}}