#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int h[N], e[2 * N], ne[2 * N], idx;
int n;
int pre[N], color[N], cnt = -1;
void add(int a, int b) {
  e[idx] = b;
  ne[idx] = h[a];
  h[a] = idx++;
}
void bfs() {
  queue<int> q;
  color[1] = 1;
  pre[1] = 1;
  q.push(1);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    int num = 1;
    for (int i = h[u]; i != -1; i = ne[i]) {
      int j = e[i];
      if (color[j]) continue;
      while (color[u] == num || color[pre[u]] == num) num++;
      color[j] = num;
      cnt = max(cnt, num);
      pre[j] = u;
      num++;
      q.push(j);
    }
  }
}
int main() {
  scanf("%d", &n);
  memset(h, -1, sizeof h);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  bfs();
  cout << cnt << endl;
  for (int i = 1; i <= n; i++) {
    cout << color[i] << " ";
  }
  return 0;
}
