#include <bits/stdc++.h>
using namespace std;
vector<int> parent(200004, 0);
vector<bool> vis(200004, false);
void dfs(int node, vector<vector<int> > &vec, vector<int> &colors);
int cnt = 1;
int main() {
  int n, x, y;
  cin >> n;
  vector<vector<int> > vec(n + 1);
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    vec[x].push_back(y);
    vec[y].push_back(x);
  }
  vector<int> colors(n + 1);
  colors[1] = 1;
  parent[1] = 0;
  dfs(1, vec, colors);
  cout << cnt << endl;
  for (int i = 1; i < n + 1; i++) cout << colors[i] << " ";
  cout << endl;
}
void dfs(int node, vector<vector<int> > &vec, vector<int> &colors) {
  vis[node] = true;
  int i, j;
  for (i = 0, j = 1; i < vec[node].size() && j <= cnt;) {
    if (colors[vec[node][i]] == 0 && !vis[vec[node][i]]) {
      if (j != colors[parent[node]] && j != colors[node]) {
        colors[vec[node][i]] = j;
        i++;
        j++;
      } else
        j++;
    } else
      i++;
  }
  while (i != vec[node].size()) {
    if (colors[vec[node][i]] == 0) colors[vec[node][i]] = ++cnt;
    i++;
  }
  for (int i = 0; i < vec[node].size(); i++) {
    if (!vis[vec[node][i]]) {
      parent[vec[node][i]] = node;
      dfs(vec[node][i], vec, colors);
    }
  }
}
