#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, m, ans[maxn], res = 0;
vector<int> mp[maxn];
void dfs(int now, int fa) {
  int i, k = 0;
  for (i = 0; i < mp[now].size(); i++) {
    int y = mp[now][i];
    if (ans[y] != 0x3f3f3f3f) continue;
    k++;
    while (k == ans[now] || k == ans[fa]) {
      ++k;
    }
    ans[y] = k;
    dfs(y, now);
  }
  res = res > k ? res : k;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    mp[x].push_back(y);
    mp[y].push_back(x);
  }
  memset(ans, 0x3f3f3f3f, sizeof(ans));
  ans[1] = 1;
  ans[0] = 0;
  dfs(1, 1);
  cout << res << endl;
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
