#include <bits/stdc++.h>
using namespace std;
vector<long long int> edges[200001];
vector<long long int> c(200001);
long long int ANS = 1;
void dfs(long long int i, long long int parent) {
  long long int k = 1;
  for (long long int j : edges[i]) {
    if (j != parent) {
      for (; k <= 200001; k++)
        if (k != c[parent] && k != c[i]) {
          ANS = max(ANS, k);
          c[j] = k;
          ++k;
          break;
        }
      dfs(j, i);
    }
  }
}
int main() {
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n - 1; i++) {
    long long int a, b;
    cin >> a >> b;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  c[1] = 1;
  dfs(1, 0);
  cout << ANS << "\n";
  for (long long int i = 1; i <= n; i++) cout << c[i] << " ";
  return 0;
}
