#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int N6 = 1e6 + 6;
const int N9 = 1e9 + 7;
const long long INFLL = (long long)1e18 + 100;
const int INF = 1e9 + 100;
const long long mod = 1e9 + 9;
const long long P = 31;
int n;
int ans[211111], otvet = 1;
std::vector<int> g[211111];
void dfs(int v, int pr) {
  set<int> has;
  int cur = 1;
  if (pr != -1) has.insert(ans[pr]);
  has.insert(ans[v]);
  while (has.count(cur)) ++cur;
  for (auto x : g[v]) {
    if (x == pr) continue;
    while (has.count(cur)) ++cur;
    has.insert(cur);
    ans[x] = cur;
    otvet = max(otvet, ans[x]);
    dfs(x, v);
  }
}
void solve() {
  cin >> n;
  int u, v;
  for (int i = 1; i < n; ++i) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  ans[1] = 1;
  dfs(1, -1);
  cout << otvet << '\n';
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << ' ';
  }
}
int main() {
  int tt = 1;
  while (tt--) {
    solve();
  }
  return 0;
}
