/*
Question:
Every cow prefers to produce milk in different places. Each place can accommodate only one cow.
Analysis:
Establish a match between the milk producing place and the cows, and then use Hungry AlgorithmFor example, cows A Like in Q Real estate milk, then
G [a] [Q] = true, Create a graph.
*/
# Include
<Iostream>
# Include
<Cstdio>
# Include
<Cstring>
Using namespace
STD;
# Define x 202
Int
XM [X], ym [X], n, m;
Bool
G [x] [X], use [x];
Int DFS (int u)
{
For (INT v = 1; v <= m; V ++)
If (G [u] [v] &! Use [v])
{
Use [v] = true;
If (ym [v] =-1 | DFS (ym [v])
{
Ym [v] = u;
XM [u] = V;
Return true;
}
}
Return false;
}
Int hungry ()
{
Memset (XM,-1, sizeof (XM ));
Memset (ym,-1, sizeof (ym ));
Int ret = 0;
For (INT u = 1; U <= N; U ++)
If (XM [u] =-1)
{
Memset (use, false, sizeof (use ));
If (DFS (u ))
RET ++;
}
Return ret;
}
Int main ()
{
Freopen ("sum. In", "r", stdin );
Freopen ("sum. Out", "W", stdout );
While (CIN> N> m)
{
Int T, X;
Memset (G, false, sizeof (g ));
For (INT I = 1; I <= N; I ++)
{
Scanf ("% d", & T );
While (t --)
{
Scanf ("% d", & X );
G [I] [x] = true;
}
}
Printf ("% d \ n", hungry ());
}
Return 0;
}