#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int ea[N], eb[N];
int other(int i, int a) { return (a == ea[i]) ? eb[i] : ea[i]; }
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  bool state[m], r[m];
  vector<bool> res(m, false);
  for (int i = 0; i < m; i++)
    ea[i] = -1, eb[i] = -1, state[i] = true, r[i] = false;
  for (int i = 0; i < n; i++) {
    int len, x;
    cin >> len;
    for (int j = 0; j < len; j++) {
      cin >> x;
      bool neg = false;
      if (x < 0) {
        res[-x - 1] = false;
        x = -x;
        state[x - 1] = !state[x - 1];
        neg = true;
      } else
        res[x - 1] = true;
      x--;
      if (ea[x] == -1) {
        ea[x] = i;
      } else {
        r[x] = neg;
        eb[x] = i;
      }
    }
  }
  vector<bool> done(n, false);
  set<int> edges[n];
  for (int i = 0; i < m; i++) {
    if (ea[i] == -1) continue;
    if (eb[i] == -1) {
      done[ea[i]] = true;
    } else if (state[i] == true) {
      done[ea[i]] = true;
      done[eb[i]] = true;
    } else {
      edges[ea[i]].insert(i);
      edges[eb[i]].insert(i);
    }
  }
  set<pair<int, int>> s;
  for (int i = 0; i < n; i++) {
    if (!done[i]) s.insert({edges[i].size(), i});
  }
  while (!s.empty()) {
    int eCount, a;
    tie(eCount, a) = *s.begin();
    s.erase(s.begin());
    if (eCount == 0) {
      cout << "NO" << endl;
      return 0;
    }
    int e = *edges[a].begin();
    int b = other(e, a);
    done[a] = true;
    res[e] = r[e] != (a == eb[e]);
    if (!done[b]) {
      pair<int, int> p = {edges[b].size(), b};
      edges[b].erase(e);
      s.erase(p);
      p.first--;
      s.insert(p);
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < m; i++) cout << res[i];
  cout << endl;
  return 0;
}
