func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > E[200005];   int U[200005], V[200005], D[200005];   int n, m;   int vs[200005];   queue<int> q;   int dfs(int u, int in) {     q.push(u);     for (int len = 0;; len++) {       int sz = q.size();       if (sz == 0) break;       in = len % 2;       for (int i = 0; i < sz; i++) {         u = q.front();         q.pop();         if (vs[u] != -1) {           if (vs[u] != in)             return false;           else             continue;         }         vs[u] = in;         for (auto e : E[u]) {           if (vs[e.first] == -1)             q.push(e.first);           else if (vs[e.first] != in ^ 1)             return false;         }       }     }     for (int i = 0; i < m; i++) {       if (vs[U[i]] == 0 && vs[V[i]] == 1) {         D[i] = 1;       } else if (vs[U[i]] == 1 && vs[V[i]] == 0) {         D[i] = 0;       } else         assert(1 == 2);     }     return true;   }   int main() {     memset(vs, -1, sizeof(vs));     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       scanf( %d%d , &U[i], &V[i]);       D[i] = -1;       E[U[i]].push_back(make_pair(V[i], i));       E[V[i]].push_back(make_pair(U[i], i));     }     if (dfs(1, 0)) {       printf( YES n );       for (int i = 0; i < m; i++) printf( %d , D[i]);       printf(  n );     } else {       printf( NO n );     }     return 0;   }   