#include <bits/stdc++.h>
using namespace std;
vector<int> gr[200113];
bool used[200113];
int color[200113];
int maxs = 0;
void dfs(int v, int s1, int t) {
  maxs = max(maxs, t);
  color[v] = t;
  used[v] = 1;
  int h = 1;
  for (int i = 0; i < gr[v].size(); i++) {
    int to = gr[v][i];
    if (!used[to]) {
      while (h == s1 || h == color[v]) h++;
      dfs(to, color[v], h);
      h++;
    }
  }
}
int main() {
  ios_base::sync_with_stdio;
  cin.tie(NULL);
  int n, a, b;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    gr[a].push_back(b);
    gr[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (!used[i]) {
      dfs(i, 0, 1);
    }
  }
  cout << maxs << endl;
  for (int i = 1; i <= n; i++) {
    cout << color[i] << " ";
  }
}
