#include <bits/stdc++.h>
using namespace std;
int col[200001];
vector<int> gr[200001];
void dfs(int src, int par, int color) {
  col[src] = color;
  int c = 1;
  for (auto nbr : gr[src]) {
    if (nbr != par) {
      while (c == col[src] || c == col[par]) c++;
      dfs(nbr, src, c);
      c++;
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  dfs(1, 1, 1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, col[i]);
  }
  cout << ans << "\n";
  for (int i = 1; i <= n; i++) cout << col[i] << " ";
  return 0;
}
