func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = (int)1e9;   const long long linf = (long long)1e18;   const double eps = (double)1e-8;   const int mod = (int)1e9 + 7;   const int maxn = (int)3e5 + 5;   int n, m;   vector<int> a[maxn];   int fl;   int c[maxn];   vector<int> ta, tb;   set<pair<int, int> > roads;   int equals(int v, int u) {     ta.clear();     tb.clear();     if (a[v].size() != a[u].size()) return 0;     for (int i = (0); i < (int)(a[v].size()); ++i) {       if (a[v][i] == u) continue;       ta.push_back(a[v][i]);     }     for (int i = (0); i < (int)(a[u].size()); ++i) {       if (a[u][i] == v) continue;       tb.push_back(a[u][i]);     }     if (ta.size() != tb.size()) return 0;     for (int i = (0); i < (int)(ta.size()); ++i) {       if (ta[i] != tb[i]) return 0;     }     return 1;   }   void dfs(int v, int pl) {     int cnt = 0;     for (int i = (0); i < (int)(a[v].size()); ++i) {       int to;       to = a[v][i];       if (c[to] != inf) {         if (abs(c[v] - c[to]) > 1) {           fl = 0;           return;         }         continue;       }       if (equals(to, v)) {         c[to] = c[v];         continue;       }     }     for (int i = (0); i < (int)(a[v].size()); ++i) {       int to;       to = a[v][i];       if (c[to] != inf) {         if (abs(c[v] - c[to]) > 1) {           fl = 0;           return;         }         continue;       }       ++cnt;       if (cnt >= 2) {         fl = 0;         break;       }       c[to] = c[v] + pl;       dfs(to, pl);     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     for (int i = (1); i <= (int)(m); ++i) {       int x, y;       cin >> x >> y;       if (x > y) swap(x, y);       if (x == y || roads.count(make_pair(x, y))) continue;       roads.insert(make_pair(x, y));       a[x].push_back(y);       a[y].push_back(x);     }     for (int i = (1); i <= (int)(n); ++i) {       c[i] = inf;       sort(a[i].begin(), a[i].end());     }     int st, pl[2], upl;     st = 1;     pl[0] = 1;     pl[1] = -1;     upl = 0;     c[st] = 0;     fl = 1;     for (int i = (0); i < (int)(a[st].size()); ++i) {       int to;       to = a[st][i];       if (c[to] != inf) {         if (abs(c[st] - c[to]) > 1) {           fl = 0;           break;         }         continue;       }       if (equals(st, to)) {         c[to] = c[st];         continue;       }     }     for (int i = (0); i < (int)(a[st].size()); ++i) {       int to;       to = a[st][i];       if (c[to] != inf) {         if (abs(c[st] - c[to]) > 1) {           fl = 0;           break;         }         continue;       }       if (upl == 2) {         fl = 0;         break;       }       c[to] = pl[upl];       dfs(to, pl[upl]);       ++upl;     }     if (!fl) {       cout <<  NO             <<   n ;       return 0;     }     int mn = 0;     for (int i = (1); i <= (int)(n); ++i) {       mn = min(mn, c[i]);     }     cout <<  YES           <<   n ;     for (int i = (1); i <= (int)(n); ++i) {       cout << c[i] - mn + 1 <<    ;     }     cout <<   n ;     return 0;   }   