#include <bits/stdc++.h>
using namespace std;
long long fun(long long a, long long b) {
  if (a > 1 and b > 1) return 1;
  if (a == 0 and b == 0) return 1;
  if (a == 0 or b == 0) {
    if (max(a, b) == 1) return 2;
    return max(a, b) - 1;
  }
  if (max(a, b) - min(a, b) > 1) return min(a, b) + 1;
  return max(a, b) + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n, k, i, j, m, u, v, clr;
  cin >> n;
  vector<long long> adj[n + 1], color(n + 1, 0);
  vector<bool> vis(n + 1, false);
  m = n - 1;
  while (m--) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  queue<pair<long long, long long> > Q;
  Q.push({1, 0});
  color[1] = 1;
  while (!Q.empty()) {
    pair<long long, long long> pr = Q.front();
    Q.pop();
    if (vis[pr.first]) continue;
    vis[pr.first] = true;
    bool flg = true;
    for (auto x : adj[pr.first]) {
      if (flg) {
        clr = fun(color[pr.first], pr.second);
        flg = !flg;
      }
      if (!vis[x]) {
        if (clr == color[pr.first]) {
          clr++;
        }
        if (clr == pr.second) {
          clr++;
        }
        if (clr == color[pr.first]) {
          clr++;
        }
        if (clr == pr.second) {
          clr++;
        }
        color[x] = clr;
        clr++;
        Q.push({x, color[pr.first]});
      }
    }
  }
  set<long long> st;
  for (auto x : color) st.insert(x);
  st.erase(0);
  cout << st.size() << endl;
  for (i = 1; i <= n; i++) cout << color[i] << " ";
}
