#include <bits/stdc++.h>
using namespace std;
void rec(vector<vector<int>> &g, vector<int> &was, int v, int c1, int c2) {
  int c = 0;
  for (int i = 0; i < g[v].size(); ++i) {
    int newV = g[v][i];
    if (was[newV] != -1) continue;
    while (c == c1 || c == c2) {
      ++c;
    }
    was[newV] = c;
    rec(g, was, newV, c2, c);
    ++c;
  }
}
int main(int argc, const char *argv[]) {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<vector<int>> g(n);
  for (int i = 0; i < n - 1; ++i) {
    int v1, v2;
    cin >> v1 >> v2;
    --v1;
    --v2;
    g[v1].push_back(v2);
    g[v2].push_back(v1);
  }
  vector<int> was(n, -1);
  was[0] = 0;
  rec(g, was, 0, -1, 0);
  cout << *max_element(was.begin(), was.end()) + 1 << endl;
  for (int i = 0; i < was.size(); ++i) {
    assert(was[i] != -1);
    cout << was[i] + 1 << ' ';
  }
  cout << endl;
  return 0;
}
