func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 5;   unsigned long long bt[maxn];   unsigned long long d[maxn];   map<unsigned long long, int> has;   pair<int, int> edg[maxn];   int f[maxn];   int id[maxn];   int lab[maxn];   vector<int> e[maxn];   int vis[maxn];   int getf(int x) {     if (x == f[x])       return x;     else       return f[x] = getf(f[x]);   }   void dfs(int x, int y, int de) {     int i;     lab[x] = de;     vis[x] = 1;     for (i = 0; i < (int)e[x].size(); i++) {       if (e[x][i] == y) continue;       dfs(e[x][i], x, de + 1);     }   }   int main() {     int i, j, n, m;     cin >> n >> m;     int x, y;     bt[0] = 1;     for (int i = 1; i <= n; i++) {       bt[i] = 3 * bt[i - 1];       d[i] = bt[i];     }     for (i = 0; i < m; i++) {       scanf( %d%d , &x, &y);       edg[i] = make_pair(x, y);       d[x] += bt[y], d[y] += bt[x];     }     j = 1;     for (i = 1; i <= n; i++) {       if (!has[d[i]]) has[d[i]] = j++;       id[i] = has[d[i]];       f[i] = i;     }     for (i = 0; i < m; i++) {       x = id[edg[i].first], y = id[edg[i].second];       if (x == y) continue;       for (j = 0; j < (int)e[x].size(); j++) {         if (e[x][j] == y) break;       }       if (j >= 2) {         printf( NO n );         return 0;       }       if (j == (int)e[x].size())         e[x].push_back(y);       else         continue;       for (j = 0; j < (int)e[y].size(); j++) {         if (e[y][j] == x) break;       }       if (j >= 2) {         printf( NO n );         return 0;       }       if (j == (int)e[y].size())         e[y].push_back(x);       else         continue;       if (getf(x) == getf(y)) {         printf( NO n );         return 0;       } else         f[getf(y)] = f[getf(x)];     }     int cnt = 0;     for (i = 1; i <= n; i++) {       if (vis[id[i]] == 0 && (int)e[id[i]].size() < 2) {         vis[id[i]] = 1;         dfs(id[i], -1, 1);       }     }     printf( YES n );     for (i = 1; i <= n; i++) printf(i == n ?  %d n  :  %d  , lab[id[i]]);   }   