#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long mx = 2e6 + 10;
int posx[] = {1, -1, 0, 0};
int posy[] = {0, 0, 1, -1};
vector<int> tree[mx], vis(mx), color(mx);
int col;
void Dfs(int src, int cur, int last, int llast) {
  color[src] = cur;
  vis[src] = true;
  llast = last;
  last = cur;
  for (auto x : tree[src]) {
    if (!vis[x]) {
      cur = (cur % col) + 1;
      while (cur == last || cur == llast) cur = (cur % col) + 1;
      Dfs(x, cur, last, llast);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1, n, k, m, a, b, c, d;
  while (t--) {
    cin >> n;
    vector<int> deg(n + 1);
    for (int i = 1; i < n; i++) {
      int u, v;
      cin >> u >> v;
      tree[u].push_back(v);
      tree[v].push_back(u);
      deg[u]++, deg[v]++;
      col = max(col, max(deg[u] + 1, deg[v] + 1));
    }
    Dfs(1, 1, 0, -1);
    cout << col << '\n';
    for (int i = 1; i <= n; i++) cout << color[i] << " \n"[i == n];
  }
  return 0;
}
