#include <bits/stdc++.h>
using namespace std;
vector<int> adj[2000001];
int vis[200001], rec[200001];
int k = 0;
void dfs(int i, int c, int prev) {
  vis[i] = true;
  int x = 0;
  for (int j = 0; j < adj[i].size(); j++) {
    if (!vis[adj[i][j]]) {
      x++;
      if (x == c || x == prev) x++;
      if (x == c || x == prev) x++;
      rec[adj[i][j]] = x;
      dfs(adj[i][j], x, c);
    }
  }
  int tmp = adj[i].size();
  k = max(k, 1 + tmp);
}
int main() {
  int n;
  scanf("%d", &n);
  ;
  memset(vis, 0, (n + 1) * sizeof(int));
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d", &u);
    ;
    scanf("%d", &v);
    ;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  rec[1] = 1;
  dfs(1, 1, -1);
  cout << k << endl;
  for (int i = 1; i <= n; i++) cout << rec[i] << " ";
  return 0;
}
