#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, m;
bool ys[N], vis[N], used[N];
vector<int> s[N], p[N];
vector<pair<long long, int> > g[N];
int st[N];
int ans[N];
int op(int u) {
  if (u > m) return u - m;
  return u + m;
}
int fa[N];
int find(int x) {
  if (x == fa[x]) return x;
  return fa[x] = find(fa[x]);
}
bool dfs(int u, int p, int num) {
  if (vis[u]) return true;
  ys[num] = true;
  for (; st[u] < (int)g[u].size(); ++st[u]) {
    pair<long long, int> it = g[u][st[u]];
    if (ys[it.second] || ys[op(it.second)]) continue;
    bool f = dfs(it.first, u, it.second);
    if (f) {
      if (!vis[u]) {
        vis[u] = true;
        if (it.second <= m)
          ans[it.second] = 1;
        else
          ans[it.second - m] = 0;
      }
    }
  }
  if (!vis[u] && num) {
    vis[u] = true;
    if (num <= m)
      ans[num] = 0;
    else
      ans[num - m] = 1;
    num = 0;
  }
  return num;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  int cnt, cc;
  for (int i = (1); i < (n + 1); i++) {
    cin >> cnt;
    while (cnt--) {
      cin >> cc;
      if (cc < 0) cc = abs(cc) + m;
      s[i].push_back(cc);
      p[cc].push_back(i);
    }
  }
  queue<int> q;
  for (int i = (1); i < (m + 1); i++) {
    if ((int)p[i].size() == 0 || (int)p[i + m].size() == 0) {
      q.push(i);
    }
  }
  cnt = 0;
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    if (ans[now]) continue;
    if ((int)p[now].size() == 0) {
      ans[now] = -1;
    } else
      ans[now] = 1;
    vector<int> t;
    if ((int)p[now].size())
      t = p[now];
    else
      t = p[now + m];
    for (auto v : t) {
      vis[v] = true;
      for (auto u : s[v]) {
        if (u != now) {
          int id;
          for (id = 0; id < (int)p[u].size(); ++id)
            if (p[u][id] == v) break;
          p[u].erase(p[u].begin() + id);
          int tmp = op(u);
          if (u > tmp) swap(u, tmp);
          if (((int)p[u].size() == 0 || (int)p[tmp].size() == 0) && !ans[u]) {
            q.push(u);
          }
        }
      }
    }
    p[now].clear(), p[now + m].clear();
  }
  for (int i = (1); i < (n + 1); i++) fa[i] = i;
  for (int i = (1); i < (m + 1); i++) {
    if (!ans[i]) {
      g[p[i][0]].push_back(pair<long long, int>(p[i + m][0], i));
      g[p[i + m][0]].push_back(pair<long long, int>(p[i][0], m + i));
    }
  }
  for (int i = (1); i < (n + 1); i++) {
    if (!vis[i]) {
      dfs(i, 0, 0);
    }
  }
  for (int i = (1); i < (n + 1); i++) {
    if (!vis[i]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES\n";
  for (int i = (1); i < (m + 1); i++) {
    if (ans[i] == -1) ans[i] = 0;
    cout << ans[i];
  }
  return 0;
}
