#include <bits/stdc++.h>
using namespace std;
int n, m;
int ans[200005];
bool ok[200005], vis[200005];
vector<int> cls[200005][2];
vector<int> eh[200005];
vector<int> pic[200005];
queue<int> q;
void init() {
  for (int i = 1; i <= n; i++) eh[i].clear();
  for (int i = 1; i <= n; i++) pic[i].clear();
  for (int i = 1; i <= m; i++) cls[i][0].clear();
  for (int i = 1; i <= m; i++) cls[i][1].clear();
}
void bfs() {
  while (!q.empty()) {
    int u = q.front();
    ok[u] = true;
    q.pop();
    for (int i = 0, num = pic[u].size(); i < num; i++) {
      int v = pic[u][i];
      if (ok[v]) continue;
      q.push(v);
      ok[v] = true;
      int e = eh[u][i];
      ans[e] = u == cls[e][1][0] ? 0 : 1;
    }
  }
}
bool dfs(int u, int f) {
  if (vis[u] || ok[u]) return true;
  vis[u] = true;
  for (int i = 0, num = pic[u].size(); i < num; i++) {
    int v = pic[u][i];
    int tmp = eh[u][i];
    if (eh[u][i] == f) continue;
    if (vis[v] || dfs(v, tmp)) {
      q.push(u);
      ok[u] = true;
      int e = eh[u][i];
      ans[e] = u == cls[e][1][0] ? 1 : 0;
      return true;
    }
  }
  return false;
}
int main() {
  while (scanf("%d %d", &n, &m) != EOF) {
    init();
    memset(ans, 0, sizeof(ans));
    memset(ok, 0, sizeof(ok));
    memset(vis, 0, sizeof(vis));
    int k, v;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &k);
      for (int j = 1; j <= k; j++) {
        scanf("%d", &v);
        if (v > 0)
          cls[v][1].push_back(i);
        else
          cls[-v][0].push_back(i);
      }
    }
    for (int i = 1; i <= m; i++) {
      if (cls[i][0].size() == 0) {
        for (int j = 0, num = cls[i][1].size(); j < num; j++) {
          q.push(cls[i][1][j]);
          ok[cls[i][1][j]] = true;
        }
        ans[i] = 1;
      } else if (cls[i][1].size() == 0) {
        for (int j = 0, num = cls[i][0].size(); j < num; j++) {
          q.push(cls[i][0][j]);
          ok[cls[i][0][j]] = true;
        }
        ans[i] = 0;
      } else {
        int u = cls[i][0][0], v = cls[i][1][0];
        pic[u].push_back(v);
        pic[v].push_back(u);
        eh[u].push_back(i);
        eh[v].push_back(i);
      }
    }
    bool flag = true;
    for (int i = 1; i <= n && flag; i++) {
      bfs();
      if (ok[i]) continue;
      if (!dfs(i, -1)) flag = false;
    }
    if (!flag)
      printf("NO\n");
    else {
      printf("YES\n");
      for (int i = 1; i <= m; i++) printf("%d", ans[i]);
      printf("\n");
    }
  }
  return 0;
}
