#include <bits/stdc++.h>   using namespace std;   const int N = 200006;   vector<vector<int> > edges(N);   vector<int> color;   bool bipartite;   vector<pair<int, int> > e;   int n, m;   void dfs(int node, int c) {     color[node] = c;     for (auto to : edges[node]) {       if (color[to] == -1) {         dfs(to, c ^ 1);       } else {         if (color[to] == color[node]) {           bipartite = false;         }       }     }     return;   }   int main() {     cin >> n >> m;     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       x--;       y--;       edges[x].push_back(y);       edges[y].push_back(x);       e.push_back(make_pair(x, y));     }     bipartite = true;     color = vector<int>(n, -1);     dfs(0, 0);     if (!bipartite) {       cout <<  NO n ;       return 0;     }     cout <<  YES n ;     for (int i = 0; i < m; i++) {       cout << (color[e[i].first] < color[e[i].second]);     }     cout <<   n ;     return 0;   }   