#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 100;
long long n, m, k, ve, ed;
bool vis[maxn], mark[maxn], val[maxn];
vector<pair<long long, long long> > h[maxn];
vector<pair<long long, pair<long long, long long> > > g[maxn];
void dfs(long long v, long long p) {
  long long u, c;
  vis[v] = 1;
  for (long long i = 0; i < g[v].size(); i++) {
    u = g[v][i].first;
    c = g[v][i].second.first;
    if (vis[u]) {
      if (c != p) {
        ve = v;
        ed = c;
      }
    } else {
      dfs(u, c);
    }
  }
  return;
}
void fix(long long v, long long p) {
  long long u, c;
  mark[v] = 1;
  for (long long i = 0; i < g[v].size(); i++) {
    u = g[v][i].first;
    c = g[v][i].second.first;
    if (c == p) {
      val[c] = 1 - g[v][i].second.second;
    } else if (!mark[u]) {
      fix(u, c);
    }
  }
  return;
}
int main() {
  long long v, u, x;
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> k;
    for (long long j = 0; j < k; j++) {
      cin >> x;
      if (x < 0)
        h[-x].push_back({i, 0});
      else
        h[x].push_back({i, 1});
    }
  }
  for (long long i = 1; i <= m; i++) {
    if (h[i].empty()) continue;
    if (h[i].size() == 1) {
      g[0].push_back({h[i][0].first, {i, h[i][0].second}});
      g[h[i][0].first].push_back({0, {i, 1 - h[i][0].second}});
    } else {
      if (h[i][0].second == h[i][1].second) {
        g[0].push_back({h[i][0].first, {i, h[i][0].second}});
        g[h[i][0].first].push_back({0, {i, 1 - h[i][0].second}});
        g[0].push_back({h[i][1].first, {i, h[i][1].second}});
        g[h[i][1].first].push_back({0, {i, 1 - h[i][1].second}});
      } else {
        g[h[i][0].first].push_back({h[i][1].first, {i, h[i][1].second}});
        g[h[i][1].first].push_back({h[i][0].first, {i, h[i][0].second}});
      }
    }
  }
  fix(0, 0);
  for (long long i = 1; i <= n; i++) {
    if (!mark[i]) {
      ve = 0;
      ed = 0;
      dfs(i, 0);
      if (ve == 0) {
        cout << "NO";
        return 0;
      }
      fix(ve, ed);
    }
  }
  cout << "YES\n";
  for (long long i = 1; i <= m; i++) {
    cout << val[i];
  }
}
