#include <bits/stdc++.h>   using namespace std;   int N, M;   vector<int> edge[300010];   vector<int> ve[300010];   int parent[300010];   int hap1[300010], hap2[300010];   int pwp1[300010], pwp2[300010];   int id[300010];   int ite = 300010;   map<int, bool> used;   int find_parent(int u) {     if (parent[u] == u) {       return u;     }     parent[u] = find_parent(parent[u]);     return parent[u];   }   void merge(int a, int b) {     a = find_parent(a);     b = find_parent(b);     if (a < b) {       swap(a, b);     }     if (a == b) {       return;     }     parent[a] = b;     return;   }   void dfs(int u, int val) {     if (id[u]) {       return;     }     id[u] = val;     used[val] = true;     if (ve[u].size() == 0) {       return;     }     if (ve[u].size() == 1) {       int v = ve[u][0];       if (id[v]) {         return;       }       if (used[val + 1]) {         dfs(v, val - 1);       } else {         dfs(v, val + 1);       }       return;     }     if (ve[u].size() == 2) {       int v = ve[u][0];       int w = ve[u][1];       if (id[v]) {         swap(v, w);       }       if (id[v]) {         return;       }       if (!id[w]) {         dfs(w, val + 1);         dfs(v, val - 1);         return;       }       if (used[val + 1]) {         dfs(v, val - 1);       } else {         dfs(v, val + 1);       }       return;     }   }   int32_t main() {     ios_base::sync_with_stdio(false);     if (fopen( cf794d.in ,  r )) {       freopen( cf794d.in ,  r , stdin);       freopen( cf794d.out ,  w , stdout);     }     cin >> N >> M;     pwp1[0] = 1;     pwp2[0] = 1;     for (int i = 1; i < 300010; i++) {       pwp1[i] = pwp1[i - 1] * 2;       pwp2[i] = pwp2[i - 1] * 2;       pwp1[i] %= 1000000007;       pwp2[i] %= 1000000861;     }     for (int i = 0; i < M; i++) {       int a, b;       cin >> a >> b;       a--;       b--;       edge[a].push_back(b);       edge[b].push_back(a);     }     for (int i = 0; i < N; i++) {       parent[i] = i;       edge[i].push_back(i);       sort(edge[i].begin(), edge[i].end());     }     for (int i = 0; i < N; i++) {       for (int j = 0; j < edge[i].size(); j++) {         hap1[i] += pwp1[edge[i][j]];         hap2[i] += pwp2[edge[i][j]];         hap1[i] %= 1000000007;         hap2[i] %= 1000000861;       }     }     for (int i = 0; i < N; i++) {       for (int j = 0; j < edge[i].size(); j++) {         int v = edge[i][j];         if (i == v) {           continue;         }         if (hap1[i] == hap1[v] && hap2[i] == hap2[v]) {           merge(i, v);         }       }     }     for (int i = 0; i < N; i++) {       if (parent[i] != i) {         continue;       }       for (int j = 0; j < edge[i].size(); j++) {         int u = find_parent(edge[i][j]);         if (i == u) {           continue;         }         ve[i].push_back(u);         ve[u].push_back(i);       }     }     for (int i = 0; i < N; i++) {       sort(ve[i].begin(), ve[i].end());       ve[i].erase(unique(ve[i].begin(), ve[i].end()), ve[i].end());     }     for (int i = 0; i < N; i++) {       if (ve[i].size() >= 3) {         cout <<  NO n ;         return 0;       }     }     cout <<  YES n ;     for (int i = 0; i < N; i++) {       if (parent[i] != i) {         continue;       }       dfs(i, ite);       ite += 300010;     }     for (int i = 0; i < N; i++) {       int u = find_parent(i);       cout << id[u] <<   n ;     }     return 0;   }