#include <bits/stdc++.h>
using namespace std;
int n;
int col[200001];
bool visited[200001];
vector<int> E[200001];
void dfs(int v, int pre) {
  if (pre == -1) {
    int d = E[v].size();
    for (int i = 0; i < d; ++i) col[E[v][i]] = i + 2;
  } else {
    int x = col[pre], y = col[v];
    int c = 1;
    for (int i : E[v]) {
      while (c == x || c == y) ++c;
      if (!visited[i]) col[i] = c++;
    }
  }
  visited[v] = true;
  for (int i : E[v])
    if (!visited[i]) dfs(i, v);
}
int main() {
  srand((unsigned)time(NULL));
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    E[a].push_back(b);
    E[b].push_back(a);
  }
  col[0] = 1;
  dfs(0, -1);
  int k = 0;
  for (int i = 0; i < n; ++i) k = max(k, col[i]);
  printf("%d\n", k);
  for (int i = 0; i < n; ++i) printf("%d ", col[i]);
  printf("\n");
  return 0;
}
