#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, n, k, t[200010];
vector<int> g[200010];
void dfs(int x, int y) {
  int j = 1;
  for (auto i : g[x])
    if (i != y) {
      while (j == t[x] || j == t[y]) j += 1;
      t[i] = j;
      dfs(i, x);
      j += 1;
    }
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++)
    scanf("%d %d", &a, &b), g[a].push_back(b), g[b].push_back(a);
  t[0] = 0;
  t[1] = 1;
  dfs(1, 0);
  cout << *max_element(t + 1, t + n + 1) << endl;
  for (int i = 1; i < n + 1; i++) printf("%d ", t[i]);
  return 0;
}
