#include #include #include using namespace std; int cas,n,m,a[110][110],match[110],vis[110],Ans[110]; char s1[110],s2[110]; int dfs(int u){ vis[u]=1; for (int i=1;i<=m;i++) if (!a[u][i]){ if (!match[i]||!vis[match[i]]&&dfs(match[i])){ match[i]=u; return 1; } } return 0; } int main(){ scanf("%d",&cas); while (cas--){ memset(a,0,sizeof a); memset(match,0,sizeof match); scanf("%d%d",&n,&m); for (int i=1;i<=n;i++){ scanf("%s%s",s1,s2); for (int j=0;j