#include <bits/stdc++.h>
using namespace std;
const int boss = 2e5;
vector<int> lj[boss + 10];
set<int> s;
int n, col[boss + 10];
void dfs(int rt, int se, int fa) {
  int a = 1;
  s.insert(se), col[rt] = se;
  for (int v : lj[rt]) {
    for (; a == fa || a == se; ++a)
      ;
    if (!col[v]) dfs(v, a, se), ++a;
  }
}
int main() {
  int i, u, v;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    lj[u].push_back(v);
    lj[v].push_back(u);
  }
  dfs(1, 1, 0), printf("%d\n", s.size());
  for (i = 1; i <= n; i++) printf("%d ", col[i]);
}
