#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c, d, war, seb[200005], vis[200005], ar[200005];
bool w[200005];
vector<long long> adj[200005];
void dfs(long long m) {
  for (int k = 0; k <= adj[m].size() + 2; k++) {
    w[k] = 0;
  }
  w[ar[seb[m]]] = 1;
  w[ar[m]] = 1;
  long long tmp = 1;
  for (int k = 0; k < adj[m].size(); k++) {
    if (vis[adj[m][k]] == 0) {
      seb[adj[m][k]] = m;
      while (w[tmp] == 1) {
        tmp++;
      }
      ar[adj[m][k]] = tmp;
      w[tmp] = 1;
      tmp++;
    }
  }
  for (int k = 0; k < adj[m].size(); k++) {
    if (vis[adj[m][k]] == 0) {
      vis[m] = 1;
      dfs(adj[m][k]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int k = 1; k < n; k++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
    long long tmp = adj[a].size() + 1;
    war = max(war, tmp);
    tmp = adj[b].size() + 1;
    war = max(war, tmp);
  }
  seb[1] = 0;
  ar[1] = 1;
  dfs(1);
  cout << war << '\n';
  for (int k = 1; k <= n; k++) {
    cout << ar[k] << ' ';
  }
}
