#include <bits/stdc++.h>
using namespace std;
vector<long long> tree[200005];
long long color[200005] = {0};
void dfs(long long u, long long parent, long long clr) {
  color[u] = clr;
  long long num = 0;
  for (long long v : tree[u]) {
    if (color[v] == 0) {
      num++;
      while (num == color[u] || num == color[parent]) num++;
      dfs(v, u, num);
    }
  }
}
int main() {
  long long n, u, v;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    cin >> u >> v;
    tree[u].push_back(v);
    tree[v].push_back(u);
  }
  dfs(1, 0, 1);
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans = max(ans, color[i]);
  cout << ans << "\n";
  for (long long i = 1; i <= n; i++) cout << color[i] << " ";
  return 0;
}
