#include <bits/stdc++.h>
using namespace std;
vector<int> v[200001];
int A[123456];
int color[201111];
void dfs(int x, int prev) {
  int cnt = 0, i = 0;
  while (i < v[x].size()) {
    if (color[v[x][i]]) {
      i++;
      continue;
    }
    cnt++;
    if (cnt == prev || cnt == color[x]) continue;
    color[v[x][i]] = cnt;
    dfs(v[x][i], color[x]);
    i++;
  }
}
int main() {
  int n, ans = 0;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
    int A = max(v[b].size(), v[a].size());
    ans = max(ans, A);
  }
  color[1] = 1;
  dfs(1, -1);
  ans++;
  cout << ans << endl;
  for (int i = 1; i <= n; i++) cout << color[i] << " ";
}
