#include <bits/stdc++.h>
using namespace std;
void inline dfs(vector<int> adj[], int sv, int n, bool vis[], int k,
                int col[]) {
  vis[sv] = true;
  unordered_map<int, int> avail;
  avail[col[sv]] = 1;
  for (int i = 0; i < adj[sv].size(); i++) {
    if (vis[adj[sv][i]]) {
      avail[col[adj[sv][i]]] = 1;
    }
  }
  int j = 1;
  for (int i = 0; i < adj[sv].size(); i++) {
    if (!vis[adj[sv][i]]) {
      for (; j <= k; j++) {
        if (avail[j] == 0) {
          col[adj[sv][i]] = j;
          avail[j] = 1;
          break;
        }
      }
    }
  }
  for (int i = 0; i < adj[sv].size(); i++) {
    if (!vis[adj[sv][i]]) {
      dfs(adj, adj[sv][i], n, vis, k, col);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> adj[n + 1];
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  int c = 0;
  for (int i = 1; i <= n; i++) {
    c = std::max(c, (int)adj[i].size());
  }
  int k = c + 1;
  cout << c + 1 << "\n";
  int col[n + 1];
  for (int i = 0; i <= n; i++) col[i] = 0;
  bool vis[n + 1];
  for (int i = 0; i <= n; i++) vis[i] = false;
  col[1] = 1;
  dfs(adj, 1, n, vis, k, col);
  for (int i = 1; i <= n; i++) printf("%d ", col[i]);
  return 0;
}
