#include <bits/stdc++.h>   using namespace std;   int n, m;   int xans[200005];   bool pos;   vector<pair<int, int> > xoc[200005];   vector<pair<int, int> > V[200005];   int erased[200005];   queue<int> toErase;   int sgn(int v) { return abs(v) / v; }   vector<pair<int, int> > E[200005];   int vis[200005];   int cycleRoot;   bool assigned[200005];   bool arcUsed[200005];   void dfs(int u) {     vis[u] = 2;     for (int i = 0, v, x, i1, i2; i < E[u].size(); i++) {       v = E[u][i].first;       x = E[u][i].second;       if (!assigned[x]) {         i1 = xoc[x][1].first == u;         i2 = 1 - i1;         xans[x] = (xoc[x][i2].second == 1);         assigned[x] = true;         if (vis[v] != 2) dfs(v);       }     }   }   bool findCycle(int u) {     vis[u] = 1;     for (int i = 0, v, x; i < E[u].size(); i++) {       v = E[u][i].first;       x = E[u][i].second;       if (arcUsed[x]) continue;       arcUsed[x] = true;       if (vis[v]) {         cycleRoot = v;         return true;       } else if (findCycle(v)) {         return true;       }     }     return false;   }   void makeE(int c1) {     for (int i = 0, x, i1, i2, c2; i < V[c1].size(); i++) {       x = V[c1][i].first;       i1 = xoc[x][1].first == c1;       i2 = 1 - i1;       c2 = xoc[x][i2].first;       if (c1 < c2) {         E[c1].push_back(make_pair(c2, x));         E[c2].push_back(make_pair(c1, x));       }     }   }   void erase(int c) {     int x, s, i1, i2;     for (int i = 0; i < V[c].size(); i++) {       x = V[c][i].first;       s = V[c][i].second;       if (xoc[x].size() == 1) {         xans[x] = (xoc[x][0].second == 1);       } else {         i1 = (xoc[x][1].first == c);         i2 = 1 - i1;         if (xoc[x][i1].second == xoc[x][i2].second) {           xans[x] = xoc[x][i1].second == 1;           if (!erased[xoc[x][i2].first]) {             erased[xoc[x][i2].first] = 1;             erase(xoc[x][i2].first);           }         } else {           if (erased[xoc[x][i2].first]) {             xans[x] = xoc[x][i1].second == 1;           } else {             erased[xoc[x][i2].first] = 1;             erase(xoc[x][i2].first);           }         }       }     }   }   int main() {     scanf( %d%d , &n, &m);     int cs, x, s;     for (int i = 0; i < n; i++) {       scanf( %d , &cs);       for (int j = 0; j < cs; j++) {         scanf( %d , &x);         s = sgn(x);         x = abs(x) - 1;         V[i].push_back(make_pair(x, s));         xoc[x].push_back(make_pair(i, s));       }     }     for (int x = 0, c1, c2; x < m; x++) {       if (xoc[x].size() == 1) {         c1 = xoc[x][0].first;         if (!erased[c1]) {           erased[c1] = 1;           erase(c1);         }       } else if (xoc[x].size() == 2 && xoc[x][0].second == xoc[x][1].second) {         c1 = xoc[x][0].first;         if (!erased[c1]) {           erased[c1] = 1;           erase(c1);         }         c2 = xoc[x][1].first;         if (!erased[c2]) {           erased[c2] = 1;           erase(c2);         }       }     }     for (int i = 0; i < n; i++) {       if (!erased[i]) {         makeE(i);       }     }     pos = true;     for (int u = 0; u < n; u++) {       if (!erased[u] && !vis[u]) {         if (findCycle(u)) {           dfs(cycleRoot);         } else {           pos = false;           break;         }       }     }     if (!pos)       printf( NO n );     else {       printf( YES n );       for (int i = 0; i < m; i++) printf( %d , xans[i]);       printf(  n );     }   }