#include <bits/stdc++.h>
using namespace std;
const long long int M = 1e9 + 7;
const long long int N = 2e5 + 7;
const long long int mod = M;
vector<long long int> adj[N];
long long int n, vist[N], ans[N], k, lst, pat[N];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long int i = 0; i < n - 1; i++) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  queue<long long int> q;
  q.push(1);
  vist[1] = 1;
  ans[1] = 1, k = 1;
  pat[1] = 1;
  long long int tp = q.front();
  q.pop();
  long long int p = 2;
  for (auto x : adj[tp]) {
    if (vist[x] == 0) {
      q.push(x);
      ans[x] = p++;
      vist[x] = 1;
      pat[x] = 1;
    }
  }
  k = p - 1;
  while (!q.empty()) {
    tp = q.front();
    q.pop();
    p = 1;
    for (auto x : adj[tp]) {
      if (vist[x] == 0) {
        q.push(x);
        if (p == ans[tp] || ans[pat[tp]] == p) {
          p++;
        }
        if (p == ans[tp] || ans[pat[tp]] == p) {
          p++;
        }
        ans[x] = p;
        vist[x] = 1;
        pat[x] = tp;
        k = max(k, p);
        p += 1;
      }
    }
  }
  cout << k << "\n";
  for (long long int i = 1; i <= n; i++) cout << ans[i] << " ";
}
