#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
template <class A, class B, class C>
struct Triple {
  A first;
  B second;
  C third;
  bool operator<(const Triple& t) const {
    if (first != t.first) return first < t.first;
    if (second != t.second) return second < t.second;
    return third < t.third;
  }
};
template <class T>
void ResizeVec(T&, vector<long long>) {}
template <class T>
void ResizeVec(vector<T>& vec, vector<long long> sz) {
  vec.resize(sz[0]);
  sz.erase(sz.begin());
  if (sz.empty()) {
    return;
  }
  for (T& v : vec) {
    ResizeVec(v, sz);
  }
}
template <class A, class B, class C>
ostream& operator<<(ostream& out, Triple<A, B, C> t) {
  return out << "(" << t.first << ", " << t.second << ", " << t.third << ")";
}
const long long N = 3e5 + 5;
long long got[N];
vector<pair<long long, long long> > where[N];
long long res[N];
long long vis1[N];
long long vis2[N];
vector<pair<long long, long long> > slo[N];
long long Get(long long var, long long cl) {
  long long w = 0;
  if (((long long)(where[var]).size()) == 2 && where[var][1].first == cl) {
    w = 1;
  }
  return where[var][w].second;
}
void dfs1(long long v) {
  vis1[v] = 1;
  for (auto p : slo[v]) {
    long long nei = p.first;
    long long wh_var = p.second;
    got[nei] = 1;
    if (vis1[nei]) {
      continue;
    }
    res[wh_var] = Get(wh_var, nei);
    dfs1(nei);
  }
}
void del(long long v, long long var) {
  for (long long i = 0; i < ((long long)(slo[v]).size()); i++) {
    if (slo[v][i].second == var) {
      swap(slo[v][i], slo[v].back());
      slo[v].pop_back();
      return;
    }
  }
  assert(false);
}
long long dfs2(long long v, long long e) {
  vis2[v] = 1;
  for (auto p : slo[v]) {
    long long nei = p.first;
    long long wh_var = p.second;
    if (vis2[nei] && e != wh_var) {
      got[nei] = 1;
      res[wh_var] = Get(wh_var, nei);
      del(nei, wh_var);
      del(v, wh_var);
      return nei;
    }
    if (vis2[nei] && e == wh_var) {
      continue;
    }
    long long ret = dfs2(nei, wh_var);
    if (ret) {
      return ret;
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  if (0) cout << fixed << setprecision(10);
  cin.tie(0);
  double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;
  long long cl, var;
  cin >> cl >> var;
  ;
  for (long long i = (1); i <= (cl); ++i) {
    long long l;
    cin >> l;
    ;
    for (long long j = (1); j <= (l); ++j) {
      long long hehs;
      cin >> hehs;
      ;
      where[abs(hehs)].push_back(make_pair(i, hehs > 0));
    }
  }
  for (long long j = (1); j <= (var); ++j) {
    if (((long long)(where[j]).size()) == 1 ||
        (((long long)(where[j]).size()) == 2 &&
         where[j][0].second == where[j][1].second)) {
      for (auto p : where[j]) {
        got[p.first] = 1;
      }
      res[j] = where[j][0].second;
    } else if (((long long)(where[j]).size()) == 2) {
      slo[where[j][0].first].push_back({where[j][1].first, j});
      slo[where[j][1].first].push_back({where[j][0].first, j});
    }
  }
  for (long long j = (1); j <= (cl); ++j) {
    if (got[j] && !vis1[j]) {
      dfs1(j);
    }
  }
  for (long long j = (1); j <= (cl); ++j) {
    if (got[j] == 0) {
      long long c = dfs2(j, -1);
      ;
      if (c == 0) {
        cout << "NO\n";
        return 0;
      }
      dfs1(c);
    }
  }
  cout << "YES\n";
  for (long long j = (1); j <= (var); ++j) {
    cout << res[j];
  }
  cout << "\n";
  return 0;
}
