#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> adj[n + 1];
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  int color[n + 1];
  memset(color, -1, sizeof(color));
  color[0] = 0;
  color[1] = 1;
  queue<pair<int, int> > q;
  q.push(make_pair(1, 0));
  while (!q.empty()) {
    int a = q.front().first, b = q.front().second;
    q.pop();
    int temp = 1;
    for (int i = 0; i < adj[a].size(); i++)
      if (color[adj[a][i]] == -1) {
        while (temp == color[a] || temp == color[b]) temp++;
        color[adj[a][i]] = temp;
        temp++;
        q.push(make_pair(adj[a][i], a));
      }
  }
  int maks = 0;
  for (int i = 1; i <= n; i++) maks = max(maks, color[i]);
  cout << maks << endl;
  for (int i = 1; i <= n; i++) cout << color[i] << ' ';
  cout << endl;
}
