#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5;
vector<int> graph[MAX_N];
int mx = 0;
int ans[MAX_N];
bool used[MAX_N];
void dfs(int u, int lst = -1) {
  used[u] = true;
  int curr = 1;
  while (ans[u] == curr || lst == curr) ++curr;
  for (int i : graph[u]) {
    if (used[i]) continue;
    ans[i] = curr++;
    while (ans[u] == curr || lst == curr) ++curr;
  }
  for (int i : graph[u]) {
    if (used[i]) continue;
    dfs(i, ans[u]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int i = 0; i < n; i++) {
    mx = max(mx, (int)graph[i].size());
  }
  int a;
  for (int i = 0; i < n; i++) {
    if ((int)graph[i].size() == mx) {
      a = i;
      break;
    }
  }
  ans[a] = 1;
  memset(used, 0, n * sizeof(bool));
  dfs(a);
  cout << mx + 1 << "\n";
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
