#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 1e5 + 7;
vector<vector<int> > graph;
bool vis[MAXN];
bool used[MAXN];
int n;
int color[MAXN];
void dfs(int pos) {
  vis[pos] = true;
  int j = 0;
  int i = 0;
  int occ = 0;
  memset(used, false, sizeof used);
  for (int i = 0; i < graph[pos].size(); i++) {
    int x = graph[pos][i];
    if (vis[x]) used[color[x]] = true;
  }
  while (i < graph[pos].size() || occ < graph[pos].size()) {
    int y = graph[pos][i];
    if (!vis[y]) {
      while (color[pos] == j || used[j] == true) j++;
      color[y] = j;
      occ++;
      j++;
      i++;
    } else {
      occ++;
      i++;
    }
  }
  for (int i = 0; i < graph[pos].size(); i++) {
    int x = graph[pos][i];
    if (!vis[x]) {
      dfs(x);
    }
  }
  return;
}
int main() {
  cin >> n;
  graph.clear();
  graph.resize(n);
  memset(vis, false, sizeof vis);
  memset(color, 0, sizeof color);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    graph[a - 1].push_back(b - 1);
    graph[b - 1].push_back(a - 1);
  }
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      dfs(i);
    }
  }
  int m = color[0] + 1;
  for (int i = 1; i < n; i++) {
    m = max(m, color[i] + 1);
  }
  cout << m << endl;
  for (int i = 0; i < n; i++) {
    cout << color[i] + 1 << " ";
  }
  return 0;
}
