#include <bits/stdc++.h>
const double PI = 3.141592653589793238460;
using namespace std;
std::vector<int> v[1000005];
int maxx;
int arr[1000005];
void dfs(int no, int p, int nn, int pn) {
  maxx = max(maxx, nn);
  int pnn = 0;
  for (int i : v[no]) {
    if (i != p) {
      pnn++;
      if (pnn == nn || pnn == pn) pnn++;
      if (pnn == nn || pnn == pn) pnn++;
      arr[i] = pnn;
      dfs(i, no, pnn, nn);
    }
  }
}
int main() {
  int n;
  cin >> n;
  memset(arr, 0, sizeof(arr));
  arr[0] = 1;
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(0, -1, 1, -1);
  cout << maxx << '\n';
  for (int i = 0; i < n; ++i) {
    cout << arr[i] << " ";
  }
  return 0;
}
