{"raw_statement":[{"iden":"problem statement","content":"We have $2N$ balls. Each ball has a color represented by an integer between $1$ and $N$ (inclusive). For each of the $N$ colors, there are exactly two balls of that color.\nThese balls are contained in $M$ cylinders placed perpendicularly to the floor. Initially, the $i$\\-th cylinder $(1 \\leq i \\leq M)$ contains $k_i$ balls, the $j$\\-th of which from the top $(1 \\leq j \\leq k_i)$ has the color $a_{i, j}$.\nYour objective is to empty all $M$ cylinders by repeating the following operation.\n\n*   Choose two different non-empty cylinders and remove the topmost ball from each of them. Here, the two balls removed must be of the same color.\n\nDetermine whether the objective is achievable."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $2 \\leq M \\leq 2 \\times 10^5$\n*   $1 \\leq k_i\\ (1 \\leq i \\leq M)$\n*   $1 \\leq a_{i,j} \\leq N\\ (1 \\leq i \\leq M,1 \\leq j \\leq k_i)$\n*   $\\sum_{i=1}^{M} k_i = 2N$\n*   For every $x\\ (1 \\leq x \\leq N)$, there exists exactly two pairs of integers $(i,j)$ such that $1 \\leq i \\leq M$, $1 \\leq j \\leq k_i$, and $a_{i,j}=x$.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$k_1$\n$a_{1,1}$ $a_{1,2}$ $\\ldots$ $a_{1,k_1}$\n$k_2$\n$a_{2,1}$ $a_{2,2}$ $\\ldots$ $a_{2,k_2}$\n$\\hspace{2.1cm}\\vdots$\n$k_M$\n$a_{M,1}$ $a_{M,2}$ $\\ldots$ $a_{M,k_M}$"},{"iden":"sample input 1","content":"2 2\n2\n1 2\n2\n1 2"},{"iden":"sample output 1","content":"Yes\n\nThe objective can be achieved as follows.\n\n1.  Choose the first and second cylinders to remove the topmost ball from each of them, which is allowed since the removed balls have the same color: $1$.\n2.  Choose the first and second cylinders to remove the topmost ball from each of them, which is allowed since the removed balls have the same color: $2$."},{"iden":"sample input 2","content":"2 2\n2\n1 2\n2\n2 1"},{"iden":"sample output 2","content":"No\n\nNo operation can be done at all, which means it is impossible to achieve the objective of emptying the $M$ cylinders."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}