#include <bits/stdc++.h>
using namespace std;
const double Pi = acos(-1);
vector<int> g[2 * int(1e5) + 5];
int par[2 * int(1e5) + 5] = {0};
int color[2 * int(1e5) + 5] = {0};
int n;
void bfs(int s) {
  queue<int> q;
  int ans = 0;
  q.push(1);
  color[1] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    int k = 0;
    for (int v : g[u]) {
      if (v != par[u]) {
        k++;
        while (k == color[u] || k == color[par[u]]) k++;
        color[v] = k;
        par[v] = u;
        q.push(v);
      }
    }
    ans = max(ans, k);
  }
  cout << ans << '\n';
  for (int i = 1; i <= n; i++) cout << color[i] << ' ';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  bfs(1);
  return 0;
}
