func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 200005;   const int G = N;   set<pair<int, int> > S;   set<int> a[N];   int ans[N];   bool was[N];   vector<int> C[G + G];   int n, m;   bool solve() {     while (!S.empty()) {       int idx = S.begin()->second;       if (a[idx].empty()) {         cerr <<  fail   << idx << endl;         return 0;       }       int u = *a[idx].begin();       ans[abs(u)] = u / abs(u);       was[idx] = 1;       S.erase(S.begin());       for (int v : C[u + G])         if (!was[v]) {           was[v] = 1;           auto it = S.find(pair<int, int>(a[v].size(), v));           assert(it != S.end());           S.erase(it);         }       for (int v : C[-u + G])         if (!was[v]) {           auto it = S.find(pair<int, int>(a[v].size(), v));           assert(it != S.end());           a[v].erase(-u);           S.erase(it);           S.insert(pair<int, int>(a[v].size(), v));         }     }     return 1;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     int s, u;     for (int i = 1; i <= n; ++i) {       cin >> s;       for (int j = 1; j <= s; ++j) {         cin >> u;         a[i].insert(u);         C[u + G].push_back(i);       }       S.insert(pair<int, int>(a[i].size(), i));     }     bool res = solve();     if (res) {       cout <<  YES n ;       for (int i = 1; i <= m; ++i) cout << (ans[i] == 1);     } else {       cout <<  NO n ;     }     return 0;   }   