atcoder#ABC272B. [ABC272B] Everyone is Friends

[ABC272B] Everyone is Friends

Score : 200200 points

Problem Statement

There are NN people numbered 1,2,,N1,2,\ldots,N.

MM parties were held. kik_i people attended the ii-th (1iM)(1\leq i \leq M) party, and they were People xi,1,xi,2,,xi,kix_{i,1},x_{i,2},\ldots,x_{i,k_i}.

Determine if every two people attended the same party at least once.

Constraints

  • 2N1002\leq N \leq 100
  • 1M1001\leq M \leq 100
  • 2kiN2\leq k_i \leq N
  • $1\leq x_{i,1}
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN MM

k1k_1 x1,1x_{1,1} x1,2x_{1,2} \ldots x1,k1x_{1,k_1}

\vdots

kMk_M xM,1x_{M,1} xM,2x_{M,2} \ldots xM,kMx_{M,k_M}

Output

Print Yes if every two people attended the same party at least once; print No otherwise.

3 3
2 1 2
2 2 3
2 1 3
Yes

Both Person 11 and Person 22 attended the 11-st party.

Both Person 22 and Person 33 attended the 22-nd party.

Both Person 11 and Person 33 attended the 33-rd party.

Therefore, every two people attended the same party at least once, so the answer is Yes.

4 2
3 1 2 4
3 2 3 4
No

Person 11 and Person 33 did not attend the same party, so the answer is No.