#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[200005], vis(200005), col(200005);
void dfs(long long int v, long long int papa) {
  vis[v] = 1;
  long long int st = 1;
  for (auto i : adj[v]) {
    if (vis[i] == 0) {
      while (st == col[v] || st == col[papa]) st++;
      col[i] = st++;
      dfs(i, v);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n - 1; i++) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  long long int deg = -1;
  for (long long int i = 1; i <= n; i++) {
    deg = max(deg, ((long long int)adj[i].size() + 1));
  }
  col[1] = 1;
  dfs(1, 0);
  cout << deg << "\n";
  for (long long int i = 1; i <= n; i++) {
    cout << col[i] << " ";
  }
}
