#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<int, int> > q;
const int N = 2e5 + 10;
int mark[N * 2], ret[N];
bool vis[N];
set<int> s[N];
int main() {
  int n, m, i, j, k, x;
  cin >> n >> m;
  for (i = 1; i <= n; ++i) {
    scanf("%d", &k);
    while (k--) {
      scanf("%d", &x);
      mark[m + x] = i;
      s[i].insert(x);
    }
    q.push(make_pair(-s[i].size(), i));
  }
  for (i = 1; i <= m; ++i) {
    if (!mark[m + i] || !mark[m - i]) {
      int u = max(mark[m + i], mark[m - i]);
      vis[u] = 1;
      if (mark[m - i] == 0) ret[i] = 1;
    }
  }
  int u;
  while (!q.empty()) {
    k = q.top().second;
    q.pop();
    if (vis[k]) continue;
    vis[k] = 1;
    if (s[k].empty()) {
      printf("NO\n");
      return 0;
    }
    x = *s[k].begin();
    if (x > 0) ret[x] = 1;
    u = mark[m - x];
    if (u) s[u].erase(-x), q.push(make_pair(-s[u].size(), u));
  }
  printf("YES\n");
  for (i = 1; i <= m; ++i) putchar('0' + ret[i]);
  putchar('\n');
}
