#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
int a, b, c, d, n, m, k;
vector<int> dis[200002];
vector<pair<int, int> > pos[200002];
vector<pair<int, int> > sm[200002];
bool cool[200002];
int ans[200002];
bool used[200002];
inline int gv(int v, int t) {
  int p = 0;
  if (pos[t][0].first != v) {
    p = 1;
  }
  return pos[t][p].second;
}
void dfs(int v) {
  if (used[v]) return;
  used[v] = 1;
  for (int _n(((int)((sm[v]).size())) - 1), i(0); i <= _n; i++) {
    int w = sm[v][i].first;
    if (used[w]) continue;
    if (cool[w]) {
      dfs(w);
      continue;
    }
    int t = sm[v][i].second;
    if (ans[t] != -1) {
      dfs(w);
      continue;
    }
    if (gv(v, t)) {
      ans[t] = 0;
    } else {
      ans[t] = 1;
    }
    dfs(w);
  }
}
vector<int> was;
bool dfs2(int v, vector<int>& cycle, int pr = -1) {
  if (used[v]) return 0;
  used[v] = 1;
  cycle.push_back(v);
  was.push_back(v);
  for (int _n(((int)((sm[v]).size())) - 1), i(0); i <= _n; i++) {
    int w = sm[v][i].first;
    if (sm[v][i].second == pr) continue;
    if (used[w]) {
      for (int _n(((int)((was).size())) - 1), j(0); j <= _n; j++)
        used[was[j]] = 0;
      reverse((cycle).begin(), (cycle).end());
      while (cycle.back() != w) {
        cycle.pop_back();
      }
      return 1;
    }
    if (dfs2(w, cycle, sm[v][i].second)) return 1;
  }
  cycle.pop_back();
  return 0;
}
int main() {
  memset(ans, -1, sizeof(ans));
  scanf("%d%d", &n, &m);
  for (int _n((n)-1), i(0); i <= _n; i++) {
    scanf("%d", &c);
    for (int _n((c)-1), j(0); j <= _n; j++) {
      scanf("%d", &a);
      dis[i].push_back(a);
      pos[abs(a)].push_back(make_pair(i, a > 0));
    }
  }
  for (int _n((m)), i(1); i <= _n; i++) {
    if ((int)((pos[i]).size()) == 0) continue;
    if ((int)((pos[i]).size()) == 1) {
      cool[pos[i][0].first] = 1;
      if (pos[i][0].second == 1)
        ans[i] = 1;
      else
        ans[i] = 0;
      continue;
    }
    if (pos[i][0].second == pos[i][1].second) {
      cool[pos[i][0].first] = 1;
      cool[pos[i][1].first] = 1;
      if (pos[i][0].second == 1)
        ans[i] = 1;
      else
        ans[i] = 0;
      continue;
    }
    if (pos[i][0].first == pos[i][1].first) {
      cool[pos[i][0].first] = 1;
      ans[i] = 1;
      continue;
    }
    sm[pos[i][0].first].push_back(make_pair(pos[i][1].first, i));
    sm[pos[i][1].first].push_back(make_pair(pos[i][0].first, i));
  }
  memset((used), 0, sizeof(used));
  for (int _n((n)-1), i(0); i <= _n; i++) {
    if (used[i]) continue;
    if (!cool[i]) continue;
    dfs(i);
  }
  for (int _n((n)-1), i(0); i <= _n; i++) {
    if (used[i]) continue;
    vector<int> cycle;
    was.clear();
    if (!dfs2(i, cycle)) {
      printf("NO\n");
      exit(0);
    }
    for (int _n(((int)((cycle).size())) - 1), j(0); j <= _n; j++) {
      int v = cycle[j];
      cool[v] = 1;
      int nx = cycle[j < (int)((cycle).size()) - 1 ? j + 1 : 0];
      for (int _n(((int)((sm[v]).size())) - 1), z(0); z <= _n; z++) {
        int w = sm[v][z].first;
        if (w != nx) continue;
        if (ans[sm[v][z].second] != -1) continue;
        int t = sm[v][z].second;
        if (gv(v, t)) {
          ans[t] = 0;
        } else {
          ans[t] = 1;
        }
        break;
      }
    }
    dfs(cycle[0]);
  }
  printf("YES\n");
  for (int _n((m)), i(1); i <= _n; i++) {
    if (ans[i] == 1)
      printf("1");
    else
      printf("0");
  }
  printf("\n");
}
