#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
void dfs(vector<vector<long long> > &g, long long p, long long v,
         vector<long long> &colors, long long &answ) {
  long long cl = 0;
  for (long long i = 0; i < g[v].size(); i++) {
    if (p >= 0 && colors[p] == cl) cl++;
    if (colors[v] == cl) cl++;
    if (p >= 0 && colors[p] == cl) cl++;
    if (g[v][i] != p) {
      colors[g[v][i]] = cl;
      answ = max(answ, cl);
      dfs(g, v, g[v][i], colors, answ);
      cl++;
    }
  }
}
int main() {
  long long n;
  cin >> n;
  vector<vector<long long> > g(n);
  for (long long i = 0; i < n - 1; i++) {
    long long v1, v2;
    cin >> v1 >> v2;
    g[v1 - 1].push_back(v2 - 1);
    g[v2 - 1].push_back(v1 - 1);
  }
  long long answ = 0;
  vector<long long> colors(n, 0);
  dfs(g, -1, 0, colors, answ);
  cout << answ + 1 << endl;
  for (long long i = 0; i < n; i++) cout << colors[i] + 1 << " ";
  cin >> n;
  return 0;
}
