#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > grafo;
vector<int> vis;
bool est;
void dfs(int n, int color) {
  vis[n] = color;
  for (int i = 0; i < grafo[n].size(); i++) {
    int w = grafo[n][i];
    if (vis[w] == -1)
      dfs(w, (color + 1) % 2);
    else {
      if (vis[w] == color) est = false;
    }
  }
}
int main() {
  int n, m, a, b, c, d, e;
  cin >> n >> m;
  vis.assign(n, -1);
  grafo.resize(n);
  vector<pair<int, int> > way;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--;
    b--;
    grafo[a].push_back(b);
    grafo[b].push_back(a);
    way.push_back(make_pair(a, b));
  }
  est = true;
  dfs(a, 0);
  if (est) {
    cout << "YES" << endl;
    for (int i = 0; i < way.size(); i++) {
      int aux = way[i].first;
      cout << vis[aux];
    }
  } else
    cout << "NO";
  return 0;
}
