#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    pq;
int main() {
  int n, a, b, c;
  cin >> n;
  vector<int> g[n + 1], ans(n + 1), vis(n + 1, 0), par(n + 1, 0),
      color(n + 1, 0);
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  queue<int> q;
  q.push(1);
  ans[1] = 1;
  par[1] = 0;
  color[0] = 0;
  color[1] = 1;
  while (!q.empty()) {
    int p = q.front();
    q.pop();
    vis[p] = 1;
    a = color[par[p]];
    b = color[p];
    c = 1;
    for (int i = 0; i < g[p].size(); i++) {
      if (!vis[g[p][i]]) {
        while (c == a || c == b) c++;
        vis[g[p][i]] = 1;
        q.push(g[p][i]);
        color[g[p][i]] = c;
        par[g[p][i]] = p;
        c++;
      }
    }
  }
  cout << *max_element(color.begin(), color.end()) << "\n";
  for (int i = 1; i <= n; i++) {
    cout << color[i] << " ";
  }
  return 0;
}
