#include <bits/stdc++.h>
using namespace std;
vector<int> col((long long int)(2e5 + 5));
vector<vector<int> > g((long long int)(2e5 + 5));
int k = 1;
void dfs(int i, int p) {
  int c = 1;
  for (auto j : g[i]) {
    if (col[j]) continue;
    while (c == col[i] || c == col[p]) c++;
    col[j] = c;
    k = max(k, c);
    c++;
  }
  for (auto j : g[i]) {
    if (j - p) dfs(j, i);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, i, a, b;
  cin >> n;
  for (i = 1; i < n; i++) cin >> a >> b, g[a].push_back(b), g[b].push_back(a);
  col[1] = 1;
  dfs(1, 0);
  cout << k << endl;
  for (i = 1; i <= n; i++) cout << col[i] << " ";
  cout << endl;
}
