#include <bits/stdc++.h>
using namespace std;
void dfs(int u, int par, int maxi, vector<int> &color, vector<vector<int>> &adj,
         int colo) {
  color[u] = colo;
  int i, v, j = 1;
  for (i = 0; i < adj[u].size(); i++) {
    if (par != -1)
      if (j == color[par]) j++;
    if (j == color[u]) j++;
    if (par != -1)
      if (j == color[par]) j++;
    v = adj[u][i];
    if (color[v] == -1) {
      dfs(v, u, maxi, color, adj, j);
      j++;
    }
  }
  return;
}
int main() {
  int n, x, y, i, colo, maxi = 0, ind = 0;
  cin >> n;
  vector<int> color(n, -1);
  vector<vector<int>> adj(n);
  for (i = 0; i < n - 1; i++)
    scanf(" %d", &x), scanf(" %d", &y), adj[x - 1].push_back(y - 1),
        adj[y - 1].push_back(x - 1);
  for (i = 0; i < n; i++) {
    if (adj[i].size() > maxi) maxi = adj[i].size(), ind = i;
  }
  for (i = 0; i < n; i++)
    if (adj[i].size() < adj[ind].size()) break;
  maxi++;
  cout << maxi << endl;
  dfs(0, -1, maxi, color, adj, 1);
  for (i = 0; i < n; i++) cout << color[i] << " ";
}
