Under construction

Still being built. Things may change

NOT a SAT problem

Time limit2sMemory limit1024 MB

Summary
Find a truth assignment that makes the given CNF false, or report NO if every clause contains both a variable and its negation.
Level

Easy2 of 10

Topics
Implementation, String
Solved
No attempts yet

Problem

A SAT problem asks whether you can assign true or false to the logical variables so that a given CNF evaluates to true.

  • A CNF is one or more clauses joined by ∧\wedge (logical AND).
  • A clause is one or more variables, or negated variables, joined by ∨\vee (logical OR).

For example, (x1∨x2∨¬x3)(x_1\vee x_2\vee\neg x_3) and (x2∨¬x4∨¬x2∨¬x4)(x_2\vee\neg x_4\vee\neg x_2\vee\neg x_4) are clauses. Joining them gives the CNF (x1∨x2∨¬x3)∧(x2∨¬x4∨¬x2∨¬x4)(x_1\vee x_2\vee\neg x_3)\wedge(x_2\vee\neg x_4\vee\neg x_2\vee\neg x_4).

This problem is not a SAT problem. Instead of making the CNF true, you must make the CNF false.

Input

The first line contains the number of variables NN and the number of clauses MM (1≤N≤5000001 \le N \le 500000, 1≤M≤2000001 \le M \le 200000).

Each of the next MM lines describes one clause. The first integer kk is the number of literals in the clause (1≤k≤2000001 \le k \le 200000), followed by kk integers aa. A positive aa means xax_a appears in the clause, and a negative aa means ¬x∣a∣\neg x_{|a|} appears in the clause (1≤∣a∣≤N1 \le |a| \le N).

The sum of all kk is at most 500000500000.

Output

On the first line, print YES if you can make the CNF false, and NO otherwise.

If you can make the CNF false, print on the second line the values of x1,x2,…,xNx_1, x_2, \ldots, x_N separated by spaces, where 11 means true and 00 means false. If several assignments work, print any one of them.

Examples2

  1. Example 1

    Input
    4 2
    3 1 2 -3
    4 2 -4 -2 -4
    
    Expected output
    YES
    0 0 1 0
    
  2. Example 2

    Input
    1 1
    2 1 -1
    
    Expected output
    NO