#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 2;
int n, x, y, res, ans[N];
vector<int> g[N];
void dfs(int n, int p) {
  int col = 1;
  for (int i = 0; i < g[n].size(); i++) {
    if (g[n][i] == p) continue;
    while (col == ans[p] || col == ans[n]) col++;
    ans[g[n][i]] = col;
    dfs(g[n][i], n);
    col++;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int u, v, i = 0; i < n - 1; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    res = max(res, (int)g[i].size());
  }
  cout << res + 1 << '\n';
  ans[1] = 1;
  dfs(1, 0);
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
