#include <bits/stdc++.h>
using namespace std;
long long GCD(long long A, long long B) {
  if (B == 0)
    return A;
  else
    return GCD(B, A % B);
}
long long modularExponentiation(long long x, long long n, long long M) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % M;
    x = (x * x) % M;
    n = n / 2;
  }
  return result;
}
long long binaryExponentiation(long long x, long long n) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = result * x;
    x = x * x;
    n = n / 2;
  }
  return result;
}
long long modInverse(long long A, long long M) {
  return modularExponentiation(A, M - 2, M);
}
long long T[200002];
vector<long long> V[200002];
void DFS(long long x, long long y) {
  long long j = 1;
  for (auto i : V[x]) {
    if (i != y) {
      while (j == T[x] || j == T[y]) j++;
      T[i] = j;
      DFS(i, x);
      j++;
    }
  }
}
int main() {
  T[1] = 1, T[0] = 0;
  long long N, x, y;
  cin >> N;
  for (long long i = 0; i < N - 1; i++) {
    cin >> x >> y;
    V[x].push_back(y);
    V[y].push_back(x);
  }
  DFS(1, 0);
  cout << *max_element(T + 1, T + N + 1) << endl;
  for (long long i = 1; i <= N; i++) cout << T[i] << " ";
  cout << endl;
}
