#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
vector<int> ans;
int cnt = 0;
vector<int> h;
void dfs(int v, int c) {
  cnt = max(cnt, c);
  ans[v] = c;
  int num = 1;
  for (int i = 0; i < g[v].size(); i++) {
    if (ans[g[v][i]] != 0) continue;
    while (num == c || num == h[v]) num++;
    h[g[v][i]] = c;
    dfs(g[v][i], num);
    num++;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  g.resize(n);
  h.resize(n);
  ans.resize(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);
  }
  for (int i = 0; i < n; i++)
    if (g[i].size() == 1) {
      dfs(i, 1);
      break;
    }
  cout << cnt << endl;
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  return 0;
}
