#include <bits/stdc++.h>   using namespace std;   const int MAXN = 4e5 + 10;   int n, m, k, t;   bool vis[MAXN], ans[MAXN];   int v[MAXN];   set<int> p[MAXN];   priority_queue<pair<int, int> > pq;   int main() {     cin >> n >> m;     memset(vis, false, sizeof(vis));     memset(ans, false, sizeof(ans));     for (int i = 0; i <= 2 * m + 2; i++) v[i] = -1;     for (int i = 1; i <= n; i++) {       cin >> k;       for (int j = 0; j < k; j++) {         cin >> t;         v[t + m] = i;         p[i].insert(t + m);       }       pq.push({-p[i].size(), i});     }     bool flag = true;     while (!pq.empty()) {       int top = pq.top().second;       pq.pop();       if (vis[top]) continue;       if (p[top].empty()) {         flag = false;         break;       }       int x = *p[top].begin();       vis[top] = true;       ans[x] = true;       int y = m + m - x;       if (v[y] != -1 && !vis[v[y]]) {         p[v[y]].erase(y);         pq.push({-p[v[y]].size(), v[y]});       }     }     if (flag) {       cout <<  YES  << endl;       for (int i = m + 1; i < m + 1 + m; i++) {         if (!ans[i])           cout << 0;         else           cout << 1;       }       cout << endl;     } else       cout <<  NO  << endl;     return 0;   }   