#include <bits/stdc++.h>
using namespace std;
;
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
int n, x, y, ans, tot;
int head[maxn], c[maxn];
struct edge {
  int v, next;
} ed[maxn << 1];
void init() {
  tot = 0;
  ans = -1;
  memset(c, -1, sizeof(c));
  memset(head, -1, sizeof(head));
  c[0] = 0;
  c[1] = 1;
}
void addedge(int u, int v) {
  ed[tot].v = v;
  ed[tot].next = head[u];
  head[u] = tot++;
  ed[tot].v = u;
  ed[tot].next = head[v];
  head[v] = tot++;
}
void dfs(int u, int p) {
  int cnt = 0;
  for (int i = head[u]; ~i; i = ed[i].next) {
    int v = ed[i].v;
    if (v != p) {
      cnt++;
      if (cnt == c[p]) cnt++;
      if (cnt == c[u]) cnt++;
      if (cnt == c[p]) cnt++;
      c[v] = cnt;
      dfs(v, u);
    }
  }
  ans = max(ans, cnt);
}
int main() {
  scanf("%d", &n);
  init();
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    addedge(x, y);
  }
  dfs(1, 0);
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) {
    printf("%d%c", c[i], i == n ? '\n' : ' ');
  }
  return 0;
}
