#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
vector<int> u[maxn];
int ans[maxn], num = 1;
void dfs(int t, int ca, int cb) {
  int siz = u[t].size();
  int k = 0;
  for (int i = 0; i < siz; i++) {
    if (ans[u[t][i]]) {
      continue;
    }
    for (k++; k < maxn; k++) {
      if (k != ca && k != cb) {
        ans[u[t][i]] = k;
        dfs(u[t][i], k, ca);
        break;
      }
    }
  }
  num = max(num, k);
}
int main() {
  int n;
  scanf("%d", &n);
  int x, y;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    u[x].push_back(y);
    u[y].push_back(x);
  }
  ans[1] = 1;
  dfs(1, 1, 0);
  printf("%d\n", num);
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
}
