#include <bits/stdc++.h>
using namespace std;
void dfs(vector<vector<int> > &G, int cur, int par, vector<int> &col);
int main() {
  int n;
  cin >> n;
  vector<vector<int> > G(n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  vector<int> col(n, 0);
  col[0] = 1;
  dfs(G, 0, 0, col);
  cout << *max_element(col.begin(), col.end()) << endl;
  for (int i = 0; i < n; i++) cout << col[i] << ' ';
  cout << endl;
  return 0;
}
void dfs(vector<vector<int> > &G, int cur, int par, vector<int> &col) {
  int color = 1;
  for (int i = 0; i < G[cur].size(); i++) {
    if (col[G[cur][i]] == 0) {
      while (color == col[cur] || color == col[par]) color++;
      col[G[cur][i]] = color;
      dfs(G, G[cur][i], cur, col);
      color++;
    }
  }
}
