#include <bits/stdc++.h>
using namespace std;
void cline() { cout << '\n'; }
template <typename T, typename... V>
void cline(T t, V... v) {
  cout << t;
  if (sizeof...(v)) cout << ' ';
  cline(v...);
}
void cspc() { cout << ' '; }
template <typename T, typename... V>
void cspc(T t, V... v) {
  cout << t;
  if (sizeof...(v)) cout << ' ';
  cspc(v...);
}
const int N = 2e5 + 5;
vector<int> adj[N];
bool visited[N];
long long col[N];
void dfs(int v, int color) {
  visited[v] = true;
  col[v] = color;
  for (int i : adj[v]) {
    if (!visited[i]) {
      dfs(i, !color);
    } else {
      if (col[i] == col[v]) {
        cspc("NO");
        exit(0);
      }
    }
  }
}
void inpg(int u, int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  vector<int> v(m);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[i] = x;
    inpg(x, y);
  }
  dfs(1, 1);
  cline("YES");
  for (int i : v) {
    cout << col[i];
  }
  return 0;
}
