#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, vector<int>> m;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    m[a].push_back(b);
    m[b].push_back(a);
  }
  map<int, pair<int, int>> c;
  vector<bool> vis(n + 1);
  queue<int> q;
  q.push(1);
  c[1] = {1, INT_MAX - 412};
  vis[1] = 1;
  while (!q.empty()) {
    auto t = q.front();
    int col = c[t].first;
    int f = c[t].second;
    int mn = min(f, col);
    col = 1;
    for (auto const &x : m[t]) {
      if (vis[x] == 0) {
        q.push(x);
        vis[x] = 1;
        while (col == f || col == c[t].first) {
          col++;
        }
        c[x] = {col++, c[t].first};
      }
    }
    q.pop();
  }
  int mx = INT_MIN;
  for (int i = 1; i <= n; i++) {
    mx = max(mx, c[i].first);
  }
  cout << mx << endl;
  for (int i = 1; i <= n; i++) {
    cout << c[i].first << ' ';
  }
  cout << endl;
}
