#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:667772160")
using namespace std;
struct __isoff {
  __isoff() {
    if (0) freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
    srand(time(0));
  }
  ~__isoff() {}
} __osafwf;
const unsigned long long p1 = 31;
const unsigned long long p2 = 29;
const double eps = 1e-8;
const double pi = acos(-1.0);
const long long inf = 1e17 + 7;
const int infi = 1e9 + 7;
const long long dd = 2e5 + 7;
const long long mod = 1e9 + 7;
int n, m;
vector<pair<int, int> > T[dd];
vector<pair<int, int> > G[dd];
vector<pair<int, int> > Hg[dd];
bool B[dd], Is[dd];
int S[dd];
int ti = 1;
int Ss[dd];
int tis = 1;
vector<int> Y;
pair<bool, int> dfs(int v, int op = -23123123) {
  if (Ss[v] == tis) {
    return make_pair(1, 0);
  }
  Y.push_back(v);
  Ss[v] = tis;
  pair<bool, int> T = make_pair(0, 0);
  for (long long i = 0; i < (long long)G[v].size(); i++) {
    if (G[v][i].second != op) {
      auto ts = dfs(G[v][i].first, G[v][i].second);
      if (ts.first) {
        if (ts.second == 0)
          T = make_pair(1, G[v][i].second);
        else
          T = ts;
      }
    }
  }
  return T;
}
int zs;
set<pair<int, int> > M;
void gg(int v) {
  S[v] = ti;
  for (long long i = 0; i < (long long)G[v].size(); i++) {
    if (G[v][i].second != zs && S[G[v][i].first] != ti) {
      B[G[v][i].first] = 1;
      S[G[v][i].first] = ti;
      Is[G[v][i].second] = 1 ^ M.count(make_pair(v, G[v][i].second));
      gg(G[v][i].first);
    }
  }
}
int Si[dd];
int Df[dd];
bool sd[dd];
bool Zs[dd];
bool Bl[dd];
vector<int> SD[dd];
map<pair<int, int>, vector<int> > Gs;
int main() {
  cin >> n >> m;
  for (long long i = 0; i < (long long)n; i++) {
    int k;
    scanf("%d", &k);
    for (long long j = 0; j < (long long)k; j++) {
      int t;
      scanf("%d", &t);
      T[abs(t)].push_back(make_pair(i, t));
      Hg[abs(t)].push_back(make_pair(i, t));
      SD[i].push_back(t);
      if (t > 0) M.insert(make_pair(i, t));
    }
  }
  for (long long i = 0; i < (long long)m + 1; i++) {
    if (T[i].size() == 2 && T[i][0].second != T[i][1].second) {
      int a = T[i][0].first, b = T[i][1].first;
      if (a > b) swap(a, b);
      Gs[make_pair(a, b)].push_back(i);
    }
  }
  for (auto t : Gs) {
    if (t.second.size() >= 2) {
      int a = t.second[0];
      int b = t.second[1];
      int q = t.first.first;
      int w = t.first.second;
      B[q] = B[w] = 1;
      Is[a] = M.count(make_pair(q, a));
      Is[b] = M.count(make_pair(w, b));
      for (auto tt : t.second) {
        Zs[tt] = 1;
        Bl[tt] = 1;
      }
    }
  }
  for (long long i = 0; i < (long long)m + 1; i++) {
    if (T[i].size() == 2 && T[i][0].second == T[i][1].second) {
      B[T[i][0].first] = 1;
      B[T[i][1].first] = 1;
      Is[i] = i == T[i][0].second;
      Zs[i] = 1;
      Bl[i] = 1;
    }
  }
  for (long long i = 0; i < (long long)m + 1; i++) {
    if (!Bl[i]) {
      vector<pair<int, int> > tm;
      for (long long j = 0; j < (long long)T[i].size(); j++) {
        if (!B[T[i][j].first]) {
          Df[T[i][j].first]++;
          Si[i]++;
          tm.push_back(T[i][j]);
        }
      }
      T[i] = tm;
    } else {
      T[i] = vector<pair<int, int> >();
    }
  }
  vector<int> TS;
  for (long long i = 0; i < (long long)m + 1; i++) {
    int t = 0, gg = -1;
    for (long long j = 0; j < (long long)T[i].size(); j++) {
      t += !B[T[i][j].first];
      if (!B[T[i][j].first]) gg = j;
    }
    if (t == 1) {
      TS.push_back(i);
      Zs[i] = 1;
    }
  }
  for (long long i = 0; i < (long long)n; i++) {
    if (Df[i] == 1) {
      int g = i;
      for (long long i = 0; i < (long long)SD[g].size(); i++) {
        if (Si[abs(SD[g][i])] > 0 && !Zs[abs(SD[g][i])]) {
          Zs[abs(SD[g][i])] = 1;
          TS.push_back(abs(SD[g][i]));
        }
      }
    }
  }
  while (!TS.empty()) {
    int i = TS.back();
    TS.pop_back();
    int t = 0, gg = -1;
    for (long long j = 0; j < (long long)T[i].size(); j++) {
      t += !B[T[i][j].first];
      if (!B[T[i][j].first]) gg = j;
    }
    if (t == 1) {
      int g = T[i][gg].first;
      B[g] = 1;
      Df[g] = infi;
      if (!Bl[i])
        Is[i] = i == T[i][gg].second, Bl[i] = 1;
      else
        continue;
      for (long long i = 0; i < (long long)SD[g].size(); i++) {
        Si[abs(SD[g][i])]--;
        if (Si[abs(SD[g][i])] == 1 && !Zs[abs(SD[g][i])]) {
          Zs[abs(SD[g][i])] = 1;
          TS.push_back(abs(SD[g][i]));
        }
      }
      if (T[i].size() == 2) {
        g = T[i][!gg].first;
        Df[g]--;
        if (Df[g] == 1 && !B[g]) {
          for (long long i = 0; i < (long long)SD[g].size(); i++) {
            if (Si[abs(SD[g][i])] > 0 && !Zs[abs(SD[g][i])]) {
              Zs[abs(SD[g][i])] = 1;
              TS.push_back(abs(SD[g][i]));
            }
          }
        }
      }
    } else {
      if (t == 2) {
        int g, q;
        if (Df[T[i][0].first] == 1) {
          g = T[i][0].first;
          q = 0;
        } else {
          g = T[i][1].first;
          q = 1;
        }
        B[g] = 1;
        Df[g] = infi;
        if (!Bl[i])
          Is[i] = i == T[i][q].second, Bl[i] = 1;
        else
          continue;
        g = T[i][!q].first;
        Df[g]--;
        if (Df[g] == 1) {
          for (long long i = 0; i < (long long)SD[g].size(); i++) {
            if (Si[abs(SD[g][i])] > 0 && !Zs[abs(SD[g][i])]) {
              Zs[abs(SD[g][i])] = 1;
              TS.push_back(abs(SD[g][i]));
            }
          }
        }
      }
    }
  }
  for (long long i = 0; i < (long long)m + 1; i++) {
    int t = 0;
    for (long long j = 0; j < (long long)T[i].size(); j++) {
      t += !B[T[i][j].first];
    }
    if (t == 2 && !Bl[i]) {
      G[T[i][0].first].push_back(make_pair(T[i][1].first, i));
      G[T[i][1].first].push_back(make_pair(T[i][0].first, i));
    }
  }
  for (long long i = 0; i < (long long)n; i++) {
    if (Ss[i] != tis) {
      Y.clear();
      auto t = dfs(i);
      if (t.first) {
        zs = t.second;
        Is[t.second] = M.count(make_pair(T[t.second][0].first, t.second));
        B[T[t.second][0].first] = 1;
        gg(T[t.second][0].first);
      }
    }
  }
  for (long long i = 0; i < (long long)m + 1; i++) {
    bool d = Is[i];
    for (long long j = 0; j < (long long)Hg[i].size(); j++) {
      if ((Hg[i][j].second == i) == d) sd[Hg[i][j].first] = 1;
    }
  }
  for (long long i = 0; i < (long long)n; i++)
    if (!sd[i]) {
      cout << "NO";
      return 0;
    }
  cout << "YES\n";
  for (long long i = 0; i < (long long)m; i++) {
    cout << Is[i + 1];
  }
}
