#include <bits/stdc++.h>
using namespace std;
vector<int> v[2 * 100001];
int color[2 * 100001];
void dfs(int s, int p, int clr, int pclr) {
  color[s] = clr;
  int y = 1;
  for (int i = 0; i < v[s].size(); i++) {
    int u = v[s][i];
    if (u == p) continue;
    while (y == clr || y == pclr) {
      y++;
    }
    dfs(u, s, y, clr);
    y++;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  memset(color, 0, sizeof color);
  dfs(1, 0, 1, -1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, color[i]);
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    cout << color[i] << " ";
  }
  return 0;
}
