#include <bits/stdc++.h>
using namespace std;
int i, i0, n, m, pre[200005];
bool ans[200005], vis[200005];
vector<int> dic[200005][2];
int fin(int x) {
  int tmp = x, tmp2;
  while (pre[tmp] != tmp) tmp = pre[tmp];
  while (x != tmp) tmp2 = pre[x], pre[x] = tmp, x = tmp2;
  return tmp;
}
void uni(int x, int y) {
  if (fin(x) != fin(y)) pre[fin(y)] = fin(x);
}
struct edge {
  int to, i;
  bool f;
};
vector<edge> mp[200005];
vector<int> q;
void dfs(int now) {
  if (vis[now]) return;
  vis[now] = 1;
  for (auto i : mp[now]) {
    ans[i.i] = i.f;
    dfs(i.to);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) {
    pre[i] = i;
    int x, y;
    scanf("%d", &x);
    while (x--) {
      bool f = 1;
      scanf("%d", &y);
      if (y < 0) f = 0, y = -y;
      dic[y][f].push_back(i);
    }
  }
  for (i = 1; i <= m; i++) {
    if (dic[i][0].size() == 1 && dic[i][1].size() == 1) {
      int x = dic[i][0][0], y = dic[i][1][0];
      if (fin(x) == fin(y))
        q.push_back(x), ans[i] = 0;
      else {
        uni(x, y);
        mp[x].push_back({y, i, 0});
        mp[y].push_back({x, i, 1});
      }
    } else if (dic[i][0].size() == 2) {
      int x = dic[i][0][0], y = dic[i][0][1];
      for (i0 = 0; i0 < 2; i0++) {
        if (fin(x) == fin(y))
          q.push_back(x), ans[i] = 0;
        else {
          uni(x, y);
          mp[x].push_back({y, i, 0});
          mp[y].push_back({x, i, 0});
        }
      }
    } else if (dic[i][1].size() == 2) {
      int x = dic[i][1][0], y = dic[i][1][1];
      for (i0 = 0; i0 < 2; i0++) {
        if (fin(x) == fin(y))
          q.push_back(x), ans[i] = 1;
        else {
          uni(x, y);
          mp[x].push_back({y, i, 1});
          mp[y].push_back({x, i, 1});
        }
      }
    } else if (dic[i][0].size() == 1) {
      int x = dic[i][0][0];
      q.push_back(x), ans[i] = 0;
    } else if (dic[i][1].size() == 1) {
      int x = dic[i][1][0];
      q.push_back(x), ans[i] = 1;
    }
  }
  for (i = 0; i < q.size(); i++) dfs(q[i]);
  for (i = 1; i <= n; i++)
    if (!vis[i]) return printf("NO\n"), 0;
  printf("YES\n");
  for (i = 1; i <= m; i++) printf("%d", ans[i]);
  return 0;
}
