#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 5e5;
int n, tc[N], ans[N], s, mx;
vector<int> g[N];
void dfs(int u, int p = 0) {
  int ptr = 1;
  for (int to : g[u]) {
    if (to != p) {
      if (ptr == ans[p]) ptr++;
      if (ptr == ans[u]) ptr++;
      if (ptr == ans[p]) ptr++;
      ans[to] = ptr++;
    }
  }
  for (int to : g[u]) {
    if (to != p) dfs(to, u);
  }
}
void solve() {
  cin >> n;
  for (int i = 1; i <= (n - 1); i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
    tc[u]++, tc[v]++;
    mx = max({mx, tc[u], tc[v]});
  }
  cout << mx + 1 << "\n";
  for (int i = 1; i <= (n); i++) {
    if (tc[i] == mx) s = i;
  }
  ans[s] = 1;
  dfs(s);
  for (int i = 1; i <= (n); i++) cout << ans[i] << ' ';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    solve();
  }
}
