#include <bits/stdc++.h>
using namespace std;
const int N = 514514;
set<int> s[N];
int a[N << 1], as[N], v[N];
int n, m, k;
multiset<pair<int, int>> q;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &k);
    for (int j = 1; j <= k; j++) scanf("%d", &x), a[m + x] = i, s[i].insert(x);
    q.insert({s[i].size(), i});
  }
  while (q.size()) {
    int k = (*q.begin()).second;
    q.erase(q.begin());
    if (v[k]) continue;
    v[k] = 1;
    if (!s[k].size()) {
      puts("NO");
      exit(0);
    }
    int x = *s[k].begin();
    if (x > 0)
      as[x] = 1;
    else
      as[-x] = 0;
    int i = a[m - x];
    if (i) s[i].erase(-x), q.insert({s[i].size(), i});
  }
  puts("YES");
  for (int i = 1; i <= m; i++) printf("%d", as[i]);
}
