#include <bits/stdc++.h>
using namespace std;
long long vis[101] = {0};
long long col[200000];
vector<vector<long long> > v(200000);
void dfs(long long num, long long par) {
  long long c = 1;
  for (auto j : v[num]) {
    if (col[j] != -1) continue;
    while (c == col[num] || (c == col[par] && par != -1)) c++;
    col[j] = c++;
    dfs(j, num);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, i, k;
  cin >> n;
  long long a, b;
  for (i = 1; i <= n - 1; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  fill(col, col + n + 1, -1);
  size_t deg = v[1].size();
  for (i = 2; i <= n; i++) {
    deg = max(deg, v[i].size());
  }
  cout << deg + 1 << endl;
  col[1] = 1;
  dfs(1, -1);
  for (i = 1; i <= n; i++) cout << col[i] << " ";
}
