#include <bits/stdc++.h>
#pragma comment(linker, "/stack:67108864")
using namespace std;
const long double EPS = 1e-9;
const long double PI = 3.1415926535897932384626433832795;
const long long INF = 1000 * 1000 * 1000 + 9;
const int NMAX = 2 * 100 * 1000 + 3;
int n, m;
vector<int> l[NMAX];
vector<pair<int, bool> > x[NMAX];
inline bool read() {
  if (!(cin >> n >> m)) return false;
  for (int i = 0; i < int(m); ++i) x[i].clear();
  for (int i = 0; i < int(n); ++i) {
    int k;
    scanf("%d", &k);
    l[i].resize(k);
    for (int j = 0; j < int(k); ++j) {
      scanf("%d", &l[i][j]);
      x[abs(l[i][j]) - 1].push_back(make_pair(i, (l[i][j] > 0)));
      l[i][j] = abs(l[i][j]) - 1;
    }
  }
  return true;
}
vector<pair<int, pair<int, bool> > > g[NMAX];
int good[NMAX];
int ans[NMAX];
void gooddfs(int v) {
  for (int i = 0; i < int(g[v].size()); ++i) {
    if (good[g[v][i].first] == 0) {
      good[g[v][i].first] = 1;
      ans[g[v][i].second.first] = !g[v][i].second.second;
      gooddfs(g[v][i].first);
    }
  }
}
bool dfs(int v, int edge) {
  if (good[v] > 0) return true;
  if (good[v] == 0) return false;
  good[v] = 2;
  for (int i = 0; i < int(g[v].size()); ++i) {
    if (g[v][i].second.first == edge) continue;
    if (dfs(g[v][i].first, g[v][i].second.first)) {
      good[v] = 1;
      ans[g[v][i].second.first] = g[v][i].second.second;
      gooddfs(v);
      return true;
    }
  }
  good[v] = 0;
  return false;
}
inline void solve() {
  memset(ans, -1, sizeof ans);
  memset(good, -1, sizeof good);
  for (int i = 0; i < int(m); ++i) g[i].clear();
  for (int i = 0; i < int(m); ++i) {
    if (x[i].size() < 2) {
      if (x[i].size() == 1) {
        ans[i] = x[i][0].second;
        good[x[i][0].first] = 1;
      }
      continue;
    }
    assert(x[i].size() == 2);
    if (x[i][0].second == x[i][1].second) {
      ans[i] = x[i][0].second;
      good[x[i][0].first] = 1;
      good[x[i][1].first] = 1;
      continue;
    }
    g[x[i][0].first].push_back(
        make_pair(x[i][1].first, make_pair(i, x[i][0].second)));
    g[x[i][1].first].push_back(
        make_pair(x[i][0].first, make_pair(i, x[i][1].second)));
  }
  bool can = true;
  for (int i = 0; i < int(n); ++i) {
    if (good[i] == -1) dfs(i, -1);
    can &= good[i];
  }
  if (!can) {
    puts("NO");
    return;
  }
  puts("YES");
  for (int i = 0; i < int(m); ++i) {
    if (ans[i] == -1) {
      printf("1");
      continue;
    }
    printf("%d", ans[i]);
  }
  puts("");
}
int main() {
  ifstream ifile("input.txt");
  if (ifile) {
    freopen("input.txt", "rt", stdin);
  }
  if (ifile) {
    freopen("output.txt", "wt", stdout);
  }
  while (read()) solve();
  return 0;
}
