#include <bits/stdc++.h>
void dfs(const std::vector<std::vector<int>>& tree, int v, int parent,
         std::vector<int>& colors) {
  int color = 1;
  for (int son : tree[v]) {
    if (son == parent) continue;
    if (colors[v] == color) color++;
    if (parent != -1 and colors[parent] == color) color++;
    if (colors[v] == color) color++;
    colors[son] = color++;
    dfs(tree, son, v, colors);
  }
}
int main() {
  int n;
  std::cin >> n;
  std::vector<std::vector<int>> tree;
  tree.resize(n);
  for (int i = 0; i < (n - 1); ++i) {
    int x;
    int y;
    std::cin >> x >> y;
    tree[x - 1].push_back(y - 1);
    tree[y - 1].push_back(x - 1);
  }
  int D = 0;
  for (const auto& v : tree) {
    D = std::max<int>(D, v.size() + 1);
  }
  std::vector<int> colors(tree.size(), -1);
  colors[0] = 1;
  dfs(tree, 0, -1, colors);
  std::cout << D << std::endl;
  for (int c : colors) {
    std::cout << c << ' ';
  }
  return 0;
}
