#include using namespace std; char a[55],b[55]; struct node{int id,ans[55],cnt;}p[55]; bool no[55][55],used[55],in[55],stop; int T,n,m,pt[55],cntt,l,pl[55]; vector qt[55]; int cmp(node x,node y){return x.cnt q;int k=p[l].cnt; while(p[l].cnt==k){q.push(l);in[l]=1;l++;} while(q.size()){ int x=q.front();q.pop(); if(p[x].cnt==0){printf("-1");stop=1;return;} for(int i=1;i<=p[x].ans[0];i++){ int y=p[x].ans[i]; if(used[y])continue; pt[p[x].id]=y;used[y]=1;cntt++; for(int j=0;j