#include <bits/stdc++.h>
using namespace std;
struct node {
  int to, nex, val;
} edge[2000010];
int head[2000010], cnt = 1, color[2000010], sum = 2;
void add(int u, int v) {
  edge[cnt].to = v;
  edge[cnt].nex = head[u];
  head[u] = cnt++;
}
void dfs(int root, int p) {
  int num = 1;
  for (int i = head[root]; ~i; i = edge[i].nex) {
    int to = edge[i].to;
    if (to == p) continue;
    while (color[root] == num || color[p] == num) num++;
    color[to] = num++;
  }
  sum = max(sum, num);
  for (int i = head[root]; ~i; i = edge[i].nex) {
    int to = edge[i].to;
    if (to == p) continue;
    dfs(to, root);
  }
}
int main() {
  int n, a, b;
  cin >> n;
  memset(head, -1, sizeof(head));
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    add(a, b);
    add(b, a);
  }
  color[1] = 1;
  dfs(1, 0);
  cout << sum - 1 << endl;
  for (int i = 1; i <= n; i++) {
    if (i == n)
      cout << color[i] << endl;
    else
      cout << color[i] << " ";
  }
  return 0;
}
