#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> a;
vector<int> check;
int n;
int colors = 0;
void dfs(int i, int color, int zap) {
  check[i] = color;
  for (auto w : a[i]) {
    if (check[w] == 0) {
      ++color;
      if (color > colors) color = 1;
      if (color == zap) color++;
      if (color > colors) color = 1;
      dfs(w, color, check[i]);
    }
  }
}
int main() {
  int i, k;
  cin >> n;
  int x, y;
  a.resize(n);
  check.resize(n);
  for (i = 0; i < n - 1; ++i) {
    cin >> x >> y;
    --x;
    --y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (i = 0; i < n; ++i) {
    if (a[i].size() + 1 > colors) {
      colors = a[i].size() + 1;
    }
  }
  cout << colors << endl;
  dfs(0, 1, 0);
  for (i = 0; i < n; ++i) {
    cout << check[i] << ' ';
  }
  return 0;
}
