#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int u, v, x, flag, id;
  Edge() {}
  Edge(int u, int v, int x, int flag, int id)
      : u(u), v(v), x(x), flag(flag), id(id) {}
};
vector<pair<int, int> > bucket[200000 + 1];
Edge pa[200000 + 1];
vector<Edge> G[200000 + 1];
queue<int> Q;
int vis[200000 + 1], visited[200000 + 1];
int var[200000 + 1];
void update(Edge &e) {
  int x = e.x, flag = e.flag;
  var[x] = flag;
}
void bfs() {
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (auto e : G[u]) {
      int v = e.v;
      if (!vis[v]) {
        vis[v] = 1;
        Q.push(v);
        update(e);
      }
    }
  }
}
bool found;
void dfs(int u, int p = -1) {
  if (found) return;
  visited[u] = 1;
  for (auto e : G[u]) {
    if (found) return;
    int v = e.v, id = e.id;
    if (id == p) continue;
    if (visited[v]) {
      update(e);
      Q.push(v);
      vis[v] = 1;
      while (u != v) {
        e = pa[u];
        update(e);
        Q.push(u);
        vis[u] = 1;
        u = e.u;
      }
      found = 1;
      return;
    }
    pa[v] = e;
    dfs(v, id);
  }
}
int main() {
  int n, m;
  while (scanf("%d", &n) == 1) {
    scanf("%d", &m);
    for (int i = 0; i < m; i++) bucket[i].clear();
    for (int i = 0; i < n; i++) G[i].clear();
    for (int u = 0; u < n; u++) {
      int K;
      scanf("%d", &K);
      for (int i = 0; i < K; i++) {
        int x;
        scanf("%d", &x);
        int X = abs(x);
        X--;
        int sign = (x > 0);
        bucket[X].push_back(make_pair(u, sign));
      }
    }
    int e = 0;
    for (int i = 0; i < n; i++) vis[i] = visited[i] = 0;
    for (int i = 0; i < m; i++) var[i] = -1;
    for (int i = 0; i < m; i++) {
      if (!((int)(bucket[i]).size())) continue;
      if (((int)(bucket[i]).size()) == 1) {
        int u = bucket[i][0].first, sign = bucket[i][0].second;
        var[i] = sign;
        vis[u] = 1;
        Q.push(u);
      } else {
        int u = bucket[i][0].first, v = bucket[i][1].first,
            sign = bucket[i][0].second;
        if (u == v) {
          if (bucket[i][0].second == 0 && bucket[i][1].second == 0)
            var[i] = 1;
          else
            var[i] = 0;
          vis[u] = 1;
          Q.push(u);
        } else {
          if (bucket[i][0].second == bucket[i][1].second) {
            if (bucket[i][0].second == 0)
              var[i] = 0;
            else
              var[i] = 1;
            vis[u] = 1;
            Q.push(u);
            vis[v] = 1;
            Q.push(v);
          } else {
            G[u].push_back(Edge(u, v, i, !sign, e));
            G[v].push_back(Edge(v, u, i, sign, e));
            e++;
          }
        }
      }
    }
    bfs();
    bool ok = 1;
    for (int i = 0; i < n; i++) {
      if (!vis[i]) {
        found = 0;
        dfs(i, -1);
        if (!found) {
          ok = 0;
          break;
        }
        bfs();
      }
    }
    puts(ok ? "YES" : "NO");
    if (ok) {
      for (int i = 0; i < m; i++)
        if (var[i] == -1) var[i] = 0;
      for (int i = 0; i < m; i++) putchar('0' + var[i]);
      puts("");
    }
  }
}
