#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
vector<int> v[maxn];
int m[maxn], flag, ans;
int vis[maxn];
int a[maxn];
void color(int u, int y) {
  int x = m[u];
  int flag = 1;
  for (int i = 0; i < v[u].size(); i++) {
    if (m[v[u][i]] == 0) {
      while ((flag == x && x != 0) || (flag == y && y != 0)) flag++;
      m[v[u][i]] = flag;
      flag++;
      color(v[u][i], x);
    }
  }
}
int main() {
  memset(m, 0, sizeof(m));
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
    a[x]++;
    a[y]++;
    ans = max(a[x], max(a[y], ans));
  }
  color(1, 0);
  printf("%d\n%d", ans + 1, m[1]);
  for (int i = 2; i <= n; i++) {
    printf(" %d", m[i]);
  }
  printf("\n");
}
