#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
const long long INF = 3e18 + 315;
long long n, d[maxn], ans;
vector<long long> g[maxn];
long long c[maxn], cs[maxn];
inline void input() {
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long u, v;
    cin >> u >> v;
    d[u]++;
    d[v]++;
    g[u].push_back(v);
    g[v].push_back(u);
  }
}
void dfs(long long v, long long pre, long long color) {
  long long k = 1;
  for (long long i : g[v]) {
    if (pre != i) {
      while (k == c[v] || k == color) k++;
      c[i] = k;
      k++;
      dfs(i, v, c[v]);
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  input();
  for (long long i = 1; i <= n; i++) ans = max(ans, d[i]);
  cout << ans + 1 << endl;
  c[1] = 1;
  dfs(1, 0, 0);
  for (long long i = 1; i <= n; i++) cout << c[i] << " ";
  return 0;
}
