#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmax(T &x, T y) {
  x = x > y ? x : y;
}
template <typename T>
void chkmin(T &x, T y) {
  x = x < y ? x : y;
}
template <typename T>
void read(T &x) {
  x = 0;
  bool w = 0;
  char ch = 0;
  for (; !isdigit(ch); ch = getchar()) w |= ch == '-';
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
  x *= w ? -1 : 1;
}
template <typename T>
void write(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void write(T x, char ch) {
  write(x);
  putchar(ch);
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
const int N = 2e5 + 5;
struct edge {
  int to, nt;
} E[N << 1];
int H[N], edgeCnt, ans;
int n, col[N], fa[N];
void addEdge(int u, int v) {
  E[++edgeCnt] = (edge){v, H[u]};
  H[u] = edgeCnt;
}
void dfs(int u, int Fa) {
  fa[u] = Fa;
  int cnt = 0;
  for (int e = H[u]; e; e = E[e].nt) {
    int v = E[e].to;
    if (v == fa[u]) continue;
    ++cnt;
    while (cnt == col[u] || cnt == col[fa[u]]) ++cnt;
    col[v] = cnt;
    chkmax(ans, cnt);
    dfs(v, u);
  }
}
int main() {
  edgeCnt = 1;
  ans = 0;
  read(n);
  for (int i = 1, u, v; i < n; i++) {
    read(u);
    read(v);
    addEdge(u, v);
    addEdge(v, u);
  }
  col[1] = 1;
  dfs(1, 0);
  writeln(ans);
  for (int i = 1; i <= n; i++) write(col[i], ' ');
  puts("");
  return 0;
}
