#include <bits/stdc++.h>
using namespace std;
long long p = 1000000007;
long long Pow(long long, long long, long long);
long long Pow(long long a, long long b, long long p) {
  if (b == 0) return 1;
  return !(b % 2) ? (Pow(a, b / 2, p) % p) * (Pow(a, b / 2, p) % p) % p
                  : (a % p) * (Pow(a, b - 1, p)) % p;
}
vector<long long> v[200001], visit(200001, -1);
long long max1;
void dfs(long long p, long long c, long long s) {
  visit[s] = c;
  long long k = 1;
  for (long long i = 0; i < v[s].size(); i++) {
    while (k == c || k == p) k++;
    if (visit[v[s][i]] == -1) dfs(c, k, v[s][i]), k++;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i;
  long long n;
  cin >> n;
  long long x, y;
  for (i = 0; i < n - 1; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
    max1 = max(max1, max((long long)v[x].size(), (long long)v[y].size()));
  }
  cout << max1 + 1 << "\n";
  dfs(-1, 1, 1);
  for (i = 1; i <= n; i++) cout << visit[i] << " ";
  cout << "\n";
}
