#include <bits/stdc++.h>
std::vector<std::vector<int> > G(200001);
std::vector<int> par(200001);
std::vector<int> col(200001);
int degx = 0;
void dfs_visit(int s, int p) {
  par[s] = p;
  bool cx[degx + 1];
  memset(cx, 0, sizeof(cx));
  cx[col[s]] = 1;
  cx[col[par[s]]] = 1;
  for (int i = 0, c = 1, j = G[s].size(); i < j; i++) {
    if (G[s][i] != par[s]) {
      if (cx[c]) {
        if (col[s] > col[par[s]]) {
          if (cx[col[par[s]] + 1])
            c = col[s] + 1;
          else
            c = col[par[s]] + 1;
        } else {
          if (cx[col[s] + 1])
            c = col[par[s]] + 1;
          else
            c = col[s] + 1;
        }
      }
      col[G[s][i]] = c;
      cx[c] = 1;
      dfs_visit(G[s][i], s);
      c++;
    }
  }
  return;
}
int main(void) {
  int n;
  std::cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int s, d;
    std::cin >> s >> d;
    G[s].push_back(d);
    G[d].push_back(s);
  }
  for (int i = 1; i <= n; i++) degx = std::max(degx, (int)G[i].size());
  degx++;
  std::cout << degx << "\n";
  col[1] = 1;
  dfs_visit(1, 0);
  for (int i = 1; i <= n; i++) std::cout << col[i] << " ";
  std::cout << "\n";
  return 0;
}
