#include <bits/stdc++.h>
using namespace std;
int n, m;
int A[500006];
int las[500006];
int B[500006];
vector<pair<int, int> > G[500006];
void ade(int u, int v, int w) {
  u = abs(u), v = abs(v);
  if (u != v) {
    G[u].emplace_back(v, w), G[v].emplace_back(u, -w);
  } else
    G[u].emplace_back(v, w);
}
vector<int> nd[500006];
int vis[500006], vs[500006];
int rt;
bool dfs(int u, int ef) {
  vis[u] = 1;
  for (auto t : G[u])
    if (ef != t.second) {
      if (vis[t.first]) {
        B[abs(t.second)] = t.second > 0;
        rt = t.first;
        return 1;
      }
      if (dfs(t.first, -t.second)) return 1;
    }
  return 0;
}
void dfs$(int u) {
  vs[u] = 1;
  for (auto t : G[u])
    if (!vs[t.first]) {
      B[abs(t.second)] = t.second > 0;
      dfs$(t.first);
    }
}
void solve() {
  cin >> n >> m;
  for (int i = (1), iend = (n); i <= iend; ++i) B[i] = -1;
  vector<pair<int, int> > ed;
  for (int i = (1), iend = (n); i <= iend; ++i) {
    int k, b;
    scanf("%d", &k);
    for (int j = (1), jend = (k); j <= jend; ++j) {
      scanf("%d", &b);
      int t = b < 0 ? -b : b;
      if (las[t]) {
        if ((las[t] > 0) == (b > 0))
          ade(las[t], las[t], b), ade(i, i, b);
        else
          ade(i, las[t], -b);
        las[t] = 0;
      } else
        las[t] = b > 0 ? i : -i;
    }
  }
  for (int i = (1), iend = (m); i <= iend; ++i)
    if (las[i]) ade(abs(las[i]), abs(las[i]), las[i] > 0 ? i : -i);
  for (int i = (1), iend = (n); i <= iend; ++i)
    if (!vs[i]) {
      if (!dfs(i, 0)) puts("NO"), exit(0);
      dfs$(rt);
    }
  puts("YES");
  for (int i = (1), iend = (m); i <= iend; ++i)
    printf("%1d", B[i] < 0 ? 0 : B[i]);
}
signed main() { solve(); }
