Problem: 'In Boolean logic, a formula is in conjunctive normal form (CNF) or clausal normal form if it is a conjunction of clauses, where a clause is a disjunction of literals' (cited from https://en.wikipedia.org/wiki/Conjunctive_normal_form)

In the other words, CNF is a formula of type <image>, where & represents a logical "AND" (conjunction), <image> represents a logical "OR" (disjunction), and vij are some boolean variables or their negations. Each statement in brackets is called a clause, and vij are called literals.

You are given a CNF containing variables x1, ..., xm and their negations. We know that each variable occurs in at most two clauses (with negation and without negation in total). Your task is to determine whether this CNF is satisfiable, that is, whether there are such values of variables where the CNF value is true. If CNF is satisfiable, then you also need to determine the values of the variables at which the CNF is true. 

It is guaranteed that each variable occurs at most once in each clause.

Input

The first line contains integers n and m (1 ≤ n, m ≤ 2·105) — the number of clauses and the number variables, correspondingly.

Next n lines contain the descriptions of each clause. The i-th line first contains first number ki (ki ≥ 1) — the number of literals in the i-th clauses. Then follow space-separated literals vij (1 ≤ |vij| ≤ m). A literal that corresponds to vij is x|vij| either with negation, if vij is negative, or without negation otherwise.

Output

If CNF is not satisfiable, print a single line "NO" (without the quotes), otherwise print two strings: string "YES" (without the quotes), and then a string of m numbers zero or one — the values of variables in satisfying assignment in the order from x1 to xm.

Examples

Input

2 2
2 1 -2
2 2 -1


Output

YES
11


Input

4 3
1 1
1 2
3 -1 -2 3
1 -3


Output

NO


Input

5 6
2 1 2
3 1 -2 3
4 -3 5 4 6
2 -6 -4
1 5


Output

YES
100010

Note

In the first sample test formula is <image>. One of possible answer is x1 = TRUE, x2 = TRUE.

Solution (in CPP):

Solution:
#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];
  }
}