#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<bool> variables;
vector<int> S;
stack<pair<int, int> > st;
vector<bool> visited;
vector<int> input_edge;
vector<vector<int> > E;
void truth(int i) {
  if (i < 0) {
    variables[-i] = false;
  } else {
    variables[i] = true;
  }
}
bool dfs(bool need_cycle) {
  pair<int, int> p;
  int v, i, e;
  while (!st.empty()) {
    p = st.top();
    v = p.first;
    i = p.second;
    st.pop();
    if (visited[v]) {
      if (!need_cycle) continue;
      truth(i);
      e = input_edge[v];
      while (e) {
        truth(-e);
        v = S[m - e];
        e = input_edge[v];
      }
      need_cycle = false;
      continue;
    }
    visited[v] = true;
    input_edge[v] = i;
    truth(i);
    for (vector<int>::iterator it = E[v].begin(); it != E[v].end(); ++it) {
      if (*it != i && S[m - *it]) st.push(make_pair(S[m - *it], -*it));
    }
  }
  return need_cycle;
}
bool solve() {
  int k, e;
  cin >> n >> m;
  variables.resize(m + 1, false);
  S.resize(2 * m + 1, 0);
  E.resize(n + 1);
  input_edge.resize(n + 1, 0);
  for (int v = 1; v <= n; ++v) {
    cin >> k;
    E[v] = vector<int>(k);
    for (int i = 0; i < k; ++i) {
      cin >> e;
      E[v][i] = e;
      if (S[e + m]) {
        st.push(make_pair(v, e));
      } else {
        S[e + m] = v;
      }
    }
  }
  for (int e = -m; e <= m; ++e) {
    if (S[e + m] && !S[m - e]) {
      st.push(make_pair(S[e + m], e));
    }
  }
  visited.resize(n + 1, false);
  dfs(false);
  for (int v = 1; v <= n; ++v) {
    if (visited[v]) continue;
    visited[v] = true;
    for (vector<int>::iterator it = E[v].begin(); it != E[v].end(); ++it) {
      st.push(make_pair(S[m - *it], -*it));
    }
    if (dfs(true)) {
      cout << "NO" << endl;
      return false;
    }
  }
  cout << "YES" << endl;
  string s(m, '0');
  for (int i = 1; i <= m; ++i) {
    if (variables[i]) s[i - 1] = '1';
  }
  cout << s;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
