#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
vector<long long> adj[N], col(N, 0);
void dfs(long long x, long long p, long long c) {
  col[x] = c;
  long long cnt = 1;
  for (auto i : adj[x]) {
    if (i == p) continue;
    if (cnt == col[x]) ++cnt;
    if (cnt == col[p]) ++cnt;
    if (cnt == col[x]) ++cnt;
    dfs(i, x, cnt);
    cnt++;
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n;
  cin >> n;
  long long mx = 0;
  for (long long i = 0; i < n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
    mx = max({mx, (long long)adj[x].size(), (long long)adj[y].size()});
  }
  cout << mx + 1 << '\n';
  dfs(1, 0, 1);
  for (long long i = 1; i <= n; i++) cout << col[i] << ' ';
}
