import java.util.*;
import java.io.*;

public class sat_as implements Runnable {
    class Edge {
        int s;
        int t;
        int c;
        int f;
        int value;
        Edge r;

        Edge(int s, int t, int c, int value) {
            this.s = s;
            this.t = t;
            this.c = c;
            this.value = value;
        }

        public String toString() {
            return s + "->" + t + " (" + f + "/" + c + ")";
        }
    }

    class Graph {
        int vn;
        ArrayList<Edge>[] es;

        Graph(int vn) {
            this.vn = vn;
            es = new ArrayList[vn];
            for (int i = 0; i < vn; i++) {
                es[i] = new ArrayList<Edge>();
            }
        }

        void addEdge(int s, int t, int c, int value) {
            Edge e = new Edge(s, t, c, value);
            Edge erev = new Edge(t, s, 0, value);
            e.r = erev;
            erev.r = e;
            es[s].add(e);
            es[t].add(erev);
        }

        boolean[] u;

        int dfs(int x, int t, int cmax) {
            if (x == t) {
                return cmax;
            }
            u[x] = true;
            for (Edge e : es[x]) {
                if (!u[e.t] && e.f < e.c) {
                    int cnew = Math.min(cmax, e.c - e.f);
                    int fv = dfs(e.t, t, cnew);
                    if (fv > 0) {
                        e.f += fv;
                        e.r.f -= fv;
                        return fv;
                    }
                }
            }
            return 0;
        }

        int maxFlow(int s, int t) {
            u = new boolean[vn];
            int f = 0;
            while (true) {
                Arrays.fill(u, false);
                int df = dfs(s, t, Integer.MAX_VALUE);
                if (df > 0) {
                    f += df;
                } else {
                    break;
                }
            }
            return f;
        }
    }

    public void solve() throws IOException {
        Scanner in = new Scanner(new File("sat.in"));
        PrintWriter out = new PrintWriter("sat.out");
        
        int n = in.nextInt();
        int m = in.nextInt();
        int[] l = new int[m];
        int[][] t = new int[m][n];
        int[] cnt = new int[n + 1];
        for (int i = 0; i < m; i++) {
            l[i] = in.nextInt();
            for (int j = 0; j < l[i]; j++) {
                t[i][j] = in.nextInt();
                cnt[Math.abs(t[i][j])]++;
            }
        }

        int na = 0;
        int nb = 0;
        for (int i = 1; i <= n; i++) {
            if (cnt[i] == 2) {
                na++;
            } else {
                nb++;
            }
        }

        int[] ind = new int[n];
        int[] rind = new int[n];
        int va = 0;
        int vb = 0;
        for (int i = 1; i <= n; i++) {
            if (cnt[i] == 2) {
                ind[i - 1] = va++;
            } else {
                ind[i - 1] = na + vb++;
            }
            rind[ind[i - 1]] = i - 1;
        }

        Graph g = new Graph(na + nb + m + na + nb + m + 2);
        for (int i = 0; i < m; i++) {
            g.addEdge(na + nb + m + na + nb + m, na + nb + i, 1, 0);
            g.addEdge(na + nb + m + na + nb + i, na + nb + m + na + nb + m + 1, 1, 0);
        }
        for (int i = 0; i < na + nb; i++) {
            g.addEdge(na + nb + m + na + nb + m, i, 1, 0);
            g.addEdge(na + nb + m + i, na + nb + m + na + nb + m + 1, 1, 0);
        }
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < l[i]; j++) {
                int z = Math.abs(t[i][j]) - 1;
                if (cnt[z + 1] == 2) {
                    g.addEdge(ind[z], na + nb + m + na + nb + i, 1, t[i][j] > 0 ? 1 : 0);
                    g.addEdge(na + nb + i, na + nb + m + ind[z], 1, t[i][j] > 0 ? 1 : 0);
                } else {
                    g.addEdge(ind[z], na + nb + m + na + nb + i, 1, t[i][j] > 0 ? 1 : 0);
                    g.addEdge(na + nb + i, na + nb + m + ind[z], 1, t[i][j] > 0 ? 1 : 0);
                    g.addEdge(ind[z], na + nb + m + ind[z], 1, t[i][j] > 0 ? 0 : 1);
                }
            }
        }

        int f = g.maxFlow(na + nb + m + na + nb + m, na + nb + m + na + nb + m + 1);
        if (f == na + nb + m) {
            out.println("YES");
            int[] vs = new int[n];
            for (int i = 0; i < na + nb; i++) {
                for (Edge e : g.es[i]) {
                    if (e.f > 0) {
                        vs[rind[i]] = e.value;
                    }
                }
            }

            for (int i = 0; i < n; i++) {
                out.print(vs[i] + " ");
            }
            out.println();
        } else {
            out.println("NO");
        }

        in.close();
        out.close();
    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
        }
    }

    public static void main(String[] arg) {
        new Thread(new sat_as()).start();
    }
}