#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
vector<int> save[maxn];
int color[maxn], n, res;
void dfs(int now, int father) {
  int k = 0;
  for (int i = 0; i < save[now].size(); i++) {
    if (save[now][i] == now || color[save[now][i]] != 0) continue;
    k++;
    while (color[now] == k || color[father] == k) k++;
    color[save[now][i]] = k;
    dfs(save[now][i], now);
  }
  res = k > res ? k : res;
}
int main() {
  scanf("%d", &n);
  for (int a, b, i = 1; i <= n - 1; i++) {
    scanf("%d%d", &a, &b);
    save[a].push_back(b);
    save[b].push_back(a);
  }
  color[1] = 1;
  dfs(1, 0);
  printf("%d\n", res);
  for (int i = 1; i <= n; i++) printf("%d ", color[i]);
  return 0;
}
