#include <bits/stdc++.h>
using namespace std;
int colors[200005];
vector<vector<int>> adj(200005);
void dfs(int v, int p) {
  int c = 1;
  while (c == colors[v] || c == colors[p]) c++;
  for (int node : adj[v]) {
    if (colors[node] == 0) {
      colors[node] = c;
      dfs(node, v);
      c++;
      while (c == colors[v] || c == colors[p]) c++;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  int maxDegree = 1;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    int degree = adj[i].size();
    maxDegree = max(maxDegree, degree + 1);
  }
  colors[1] = 1;
  dfs(1, 0);
  cout << maxDegree << "\n";
  for (int i = 1; i <= n; i++) cout << colors[i] << " ";
  cout << "\n";
}
