#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200005;
vector<int> G[MAX_N];
int m, n, a, b;
int color[MAX_N];
int ans;
void dfs(int now, int p) {
  int cur = 1;
  for (int i = 0; i < G[now].size(); ++i) {
    int v = G[now][i];
    if (v == p) {
      continue;
    }
    while (cur == color[p] || cur == color[now]) {
      cur++;
    }
    color[v] = cur++;
    ans = max(ans, color[v]);
    dfs(v, now);
  }
}
int main() {
  cin >> n;
  ans = 0;
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  color[1] = 1;
  dfs(1, 0);
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) {
    printf("%d ", color[i]);
  }
  return 0;
}
