#include <bits/stdc++.h>
using namespace std;
struct node {
  int v, next;
} edge[400010];
int cnt, head[200010], col[200010], maxx;
void addEdge(int u, int v) {
  edge[cnt].v = v;
  edge[cnt].next = head[u];
  head[u] = cnt++;
}
void dfs(int u, int fa) {
  int cur = 1;
  while (cur == col[fa] || cur == col[u]) cur++;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    if (v == fa) continue;
    while (col[fa] == cur || col[u] == cur) cur++;
    col[v] = cur;
    if (cur > maxx) maxx = cur;
    cur++;
  }
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    if (v == fa) continue;
    dfs(v, u);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int x, y;
  cnt = 0;
  memset(head, -1, sizeof(head));
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    addEdge(x, y);
    addEdge(y, x);
  }
  maxx = 1;
  col[1] = 1;
  dfs(1, 0);
  printf("%d\n", maxx);
  for (int i = 1; i <= n; i++) {
    if (i > 1) printf(" ");
    printf("%d", col[i]);
  }
  printf("\n");
}
