{"raw_statement":[{"iden":"problem statement","content":"On a planet far, far away, $M$ languages are spoken. They are conveniently numbered $1$ through $M$.\nFor _CODE FESTIVAL 20XX_ held on this planet, $N$ participants gathered from all over the planet.\nThe $i$\\-th $(1≦i≦N)$ participant can speak $K_i$ languages numbered $L_{i,1}, L_{i,2}, ..., L_{i,{}K_i}$.\nTwo participants $A$ and $B$ can _communicate_ with each other if and only if one of the following conditions is satisfied:\n\n*   There exists a language that both $A$ and $B$ can speak.\n*   There exists a participant $X$ that both $A$ and $B$ can communicate with.\n\nDetermine whether all $N$ participants can communicate with all other participants."},{"iden":"constraints","content":"*   $2≦N≦10^5$\n*   $1≦M≦10^5$\n*   $1≦K_i≦M$\n*   $($The sum of all $K_i)≦10^5$\n*   $1≦L_{i,j}≦M$\n*   $L_{i,1}, L_{i,2}, ..., L_{i,{}K_i}$ are pairwise distinct."},{"iden":"partial score","content":"*   $200$ points will be awarded for passing the test set satisfying the following: $N≦1000$, $M≦1000$ and $($The sum of all $K_i)≦1000$.\n*   Additional $200$ points will be awarded for passing the test set without additional constraints."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$\n$K_1$ $L_{1,1}$ $L_{1,2}$ $...$ $L_{1,{}K_1}$\n$K_2$ $L_{2,1}$ $L_{2,2}$ $...$ $L_{2,{}K_2}$\n$:$\n$K_N$ $L_{N,1}$ $L_{N,2}$ $...$ $L_{N,{}K_N}$"},{"iden":"sample input 1","content":"4 6\n3 1 2 3\n2 4 2\n2 4 6\n1 6"},{"iden":"sample output 1","content":"YES\n\nAny two participants can communicate with each other, as follows:\n\n*   Participants $1$ and $2$: both can speak language $2$.\n*   Participants $2$ and $3$: both can speak language $4$.\n*   Participants $1$ and $3$: both can communicate with participant $2$.\n*   Participants $3$ and $4$: both can speak language $6$.\n*   Participants $2$ and $4$: both can communicate with participant $3$.\n*   Participants $1$ and $4$: both can communicate with participant $2$.\n\nNote that there can be languages spoken by no participant."},{"iden":"sample input 2","content":"4 4\n2 1 2\n2 1 2\n1 3\n2 4 3"},{"iden":"sample output 2","content":"NO\n\nFor example, participants $1$ and $3$ cannot communicate with each other."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}