#include <bits/stdc++.h>   using namespace std;   int N, M, lb[300010], ind[300010];   vector<int> g[300010], g2[300010];   int val[300010];   bool viz[300010];   int dfs(int nod, int v) {     val[nod] = v;     viz[nod] = 1;     for (int nxt : g2[nod]) {       if (viz[nxt]) continue;       return dfs(nxt, v + 1);     }     return nod;   }   int main() {     cin >> N >> M;     int i, x, y;     for (i = 1; i <= M; i++) {       cin >> x >> y;       g[x].push_back(y);       g[y].push_back(x);     }     for (i = 1; i <= N; i++) {       g[i].push_back(i);       sort(g[i].begin(), g[i].end());       ind[i] = i;     }     sort(ind + 1, ind + N + 1, [](int x, int y) { return g[x] < g[y]; });     lb[ind[1]] = 1;     for (i = 2; i <= N; i++)       if (g[ind[i]] == g[ind[i - 1]])         lb[ind[i]] = lb[ind[i - 1]];       else         lb[ind[i]] = 1 + lb[ind[i - 1]];     for (i = 1; i <= N; i++)       for (int nxt : g[i]) {         if (lb[nxt] == lb[i]) continue;         g2[lb[i]].push_back(lb[nxt]);       }     int cr = dfs(1, 1);     memset(val, 0, sizeof(val));     memset(viz, 0, sizeof(viz));     dfs(cr, 1);     for (i = 1; i <= lb[ind[N]]; i++)       if (val[i] == 0) {         cout <<  NO n ;         return 0;       }     cout <<  YES n ;     for (i = 1; i <= N; i++) cout << val[lb[i]] <<    ;     cout <<   n ;     return 0;   }   