| 2020-2021 ICPC, Moscow Subregional |
|---|
| Finished |
There are multiple playing cards. Each card has two sides, black and white, and a rank, which is a number from $$$1$$$ to $$$n$$$. There may be several cards of the same rank.
You're trying to solve a puzzle. In the puzzle all cards are arranged into $$$m$$$ lanes. In one turn you can simultaneously flip all cards of a certain rank (that is, black cards become white and vice versa). If every lane contains at least one white card, you win.
Having struggled for several hours, you finally solved the puzzle... only to find out that you misinterpreted the rules: there should be at least one white card in every lane, and you got into a position where there is at most one. Disappointed, you made a series of irrelevant flips.
Can you solve the puzzle according to its original rules?
In the first line of the input there are two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 200\,000$$$), the number of ranks and lanes respectively. Next $$$m$$$ lines describe lanes.
The description of each lane starts with integer $$$k$$$ ($$$k \geq 1$$$), the number of cards in this lane. It is followed by $$$k$$$ non-zero integers with absolute value at most $$$n$$$ which describe cards. Positive integer $$$x$$$ denotes a white card of rank $$$x$$$, while integer $$$-x$$$ denotes a black card of rank $$$x$$$.
The total number of cards in all lanes does not exceed $$$500\,000$$$.
It is guaranteed that there exists a sequence of flips leading to a position where each lane contains at most one white card. Note, however, that your program should find a position with at least one white card in each lane (it is not necessarily possible).
If it is impossible to reach a position with at least one white card in each lane, print "No".
Otherwise, print "Yes" and integer $$$f$$$ — the number of required flips. Then print $$$f$$$ distinct integers between $$$1$$$ and $$$n$$$, denoting the ranks to flip.
If there are multiple solutions, print any of them.
4 3 2 1 -2 2 -1 -3 3 1 3 4
Yes 1 3
1 2 1 1 1 -1
No
In the first sample, one of the possible ways to reach the position with at most one white card in each lane is to flip cards of rank $$$1$$$ and cards of rank $$$4$$$. If you flip cards of rank $$$3$$$, you reach the position with at least one white card in each lane.
| Name |
|---|


