#include <bits/stdc++.h>
using namespace std;
const int size = 2e5 + 5;
int color[size] = {0}, d = 0;
vector<int> g[size];
void dfs(int src, int par, int x, int y) {
  color[src] = x;
  d = max(d, x);
  int t = 1;
  for (auto i : g[src]) {
    while (t == x || t == y) t++;
    if (i != par) dfs(i, src, t++, x);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0, u, v; i < n - 1; i++)
    cin >> u >> v, g[u].push_back(v), g[v].push_back(u);
  dfs(1, -1, 1, 0);
  cout << d << "\n";
  for (int i = 1; i <= n; i++) cout << color[i] << " ";
  cout << "\n";
}
