#include <bits/stdc++.h>
using namespace std;
int n, f[200005], dd[200005], ans;
vector<int> a[200005];
void dfs(int u, int val) {
  int cnt = 0;
  dd[u] = 1;
  for (auto v : a[u]) {
    if (!dd[v]) {
      cnt++;
      if (cnt == val || cnt == f[u]) {
        cnt++;
        if (cnt == val || cnt == f[u]) cnt++;
      }
      f[v] = cnt;
      ans = max(ans, cnt);
      dfs(v, f[u]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    a[u].push_back(v);
    a[v].push_back(u);
  }
  f[1] = 1;
  dfs(1, 0);
  cout << ans;
  cout << "\n";
  for (int i = 1; i <= n; i++) cout << f[i] << ' ';
  return 0;
}
