#include <bits/stdc++.h>
using namespace std;
struct node {
  int to, nxt;
} e[1000000];
int k;
void build(int a, int b) {
  e[k].nxt = e[a].nxt;
  e[a].nxt = k;
  e[k].to = b;
  k++;
  e[k].nxt = e[b].nxt;
  e[b].nxt = k;
  e[k].to = a;
  k++;
}
int color[200010], vis[200010], color_before[200010];
int main() {
  int n, a, b;
  scanf("%d", &n);
  k = n + 1;
  memset(e, -1, sizeof(e));
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &a, &b);
    build(a, b);
  }
  queue<int> que;
  que.push(1);
  vis[1] = 1;
  color[1] = 1;
  color_before[1] = 0;
  int color1, color2;
  int max = 0;
  while (!que.empty()) {
    int now = que.front();
    que.pop();
    color2 = color_before[now];
    color1 = color[now];
    int Color = 1;
    int cnt = 0;
    for (int i = e[now].nxt; i != -1; i = e[i].nxt) {
      cnt++;
      int to = e[i].to;
      if (vis[to]) continue;
      que.push(to);
      vis[to] = 1;
      while (Color == color1 || Color == color2) Color++;
      color[to] = Color++;
      color_before[to] = color[now];
    }
    max = max > cnt ? max : cnt;
  }
  printf("%d\n", max + 1);
  for (int i = 1; i <= n; i++) {
    printf("%d ", color[i]);
  }
  printf("\n");
  return 0;
}
