#include <bits/stdc++.h>
using namespace std;
const int maxn = 200200;
int n, m, k, x, C, C1, C2;
vector<int> g[maxn], h[maxn], v[maxn], tc;
bool vis[maxn], vis2[maxn], mark[maxn], c[maxn];
int val[maxn];
int abs(int V) {
  if (V < 0) return -V;
  return V;
}
void dfs(int V) {
  vis[V] = true;
  for (int i = 0; i < v[V].size(); i++)
    if (!vis2[abs(v[V][i])]) {
      vis2[abs(v[V][i])] = true;
      if (v[V][i] < 0) {
        C1 = g[-v[V][i]][0];
        C2 = g[-v[V][i]][1];
        if (C1 != V)
          C = C1;
        else
          C = C2;
        if (!vis[C])
          dfs(C);
        else
          c[C] = true;
      } else {
        C1 = h[v[V][i]][0];
        C2 = h[v[V][i]][1];
        if (C1 != V)
          C = C1;
        else
          C = C2;
        if (!vis[C])
          dfs(C);
        else
          c[C] = true;
      }
    }
}
void dfs2(int V) {
  mark[V] = true;
  for (int i = 0; i < v[V].size(); i++)
    if (!val[abs(v[V][i])]) {
      if (v[V][i] < 0) {
        val[-v[V][i]] = 1;
        C1 = g[-v[V][i]][0];
        C2 = g[-v[V][i]][1];
        if (C1 != V)
          C = C1;
        else
          C = C2;
        if (!mark[C]) dfs2(C);
      } else {
        val[v[V][i]] = -1;
        C1 = h[v[V][i]][0];
        C2 = h[v[V][i]][1];
        if (C1 != V)
          C = C1;
        else
          C = C2;
        if (!mark[C]) dfs2(C);
      }
    }
}
int main() {
  scanf("%d%d", &m, &n);
  for (int i = 0; i < m; i++) {
    scanf("%d", &k);
    for (int j = 0; j < k; j++) {
      scanf("%d", &x);
      v[i].push_back(x);
      if (x < 0)
        h[-x].push_back(i);
      else
        g[x].push_back(i);
    }
  }
  for (int i = 1; i <= n; i++)
    if ((!g[i].size()) != (!h[i].size()))
      if (g[i].size()) {
        val[i] = 1;
        for (int j = 0; j < g[i].size(); j++)
          if (!mark[g[i][j]]) {
            mark[g[i][j]] = true;
            tc.push_back(g[i][j]);
          }
      } else {
        val[i] = -1;
        for (int j = 0; j < h[i].size(); j++)
          if (!mark[h[i][j]]) {
            mark[h[i][j]] = true;
            tc.push_back(h[i][j]);
          }
      }
  for (int i = 0; i < tc.size(); i++)
    for (int j = 0; j < v[tc[i]].size(); j++)
      if (!val[abs(v[tc[i]][j])]) {
        if (v[tc[i]][j] < 0) {
          val[-v[tc[i]][j]] = 1;
          for (int l = 0; l < g[-v[tc[i]][j]].size(); l++)
            if (!mark[g[-v[tc[i]][j]][l]]) {
              mark[g[-v[tc[i]][j]][l]] = true;
              tc.push_back(g[-v[tc[i]][j]][l]);
            }
        } else {
          val[v[tc[i]][j]] = -1;
          for (int l = 0; l < h[v[tc[i]][j]].size(); l++)
            if (!mark[h[v[tc[i]][j]][l]]) {
              mark[h[v[tc[i]][j]][l]] = true;
              tc.push_back(h[v[tc[i]][j]][l]);
            }
        }
      }
  for (int i = 0; i < m; i++)
    if (!mark[i] && !vis[i]) dfs(i);
  for (int i = 0; i < m; i++)
    if (!mark[i] && c[i]) dfs2(i);
  for (int i = 0; i < m; i++)
    if (!mark[i]) {
      printf("NO\n");
      return 0;
    }
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%d", max(0, val[i]));
  printf("\n");
  return 0;
}
