#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, mark[200005], pos[200005 << 1], ans[200005 << 1];
set<int> st[200005];
int main() {
  priority_queue<pair<int, int> > Q;
  scanf("%d%d", &n, &m);
  memset(pos, -1, sizeof(pos));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    for (int j = 1; j <= x; j++) {
      scanf("%d", &y);
      pos[m + y] = i;
      st[i].insert(y);
    }
    Q.push(make_pair(-st[i].size(), i));
  }
  while (!Q.empty()) {
    int t = Q.top().second;
    Q.pop();
    if (mark[t]) continue;
    mark[t] = 1;
    if (st[t].empty()) {
      puts("NO");
      return 0;
    }
    x = *st[t].begin();
    ans[m + x] = 1;
    if (~pos[m - x] && !mark[pos[m - x]]) {
      st[pos[m - x]].erase(-x);
      Q.push(make_pair(-st[pos[m - x]].size(), pos[m - x]));
    }
  }
  puts("YES");
  for (int i = 1; i <= m; i++) printf("%d", ans[m + i]);
  puts("");
  return 0;
}
