#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return GCD(b, a % b);
  }
}
bool yoyo(const char p1, const char p2) { return int(p1) > int(p2); }
long long vis[500005];
vector<long long> edg[500005];
long long colors;
long long colarr[500005];
void dfs(long long ch, long long pa) {
  long long c = 1;
  vis[ch] = 1;
  for (long long i = 0; i < edg[ch].size(); i++) {
    if (vis[edg[ch][i]] == 0) {
      while (c == colarr[ch] || c == colarr[pa]) {
        c++;
      }
      colarr[edg[ch][i]] = c++;
      dfs(edg[ch][i], ch);
    }
  }
}
int main() {
  long long t, n, a, b, c, d, i, j;
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n;
  for (i = 0; i < n - 1; i++) {
    cin >> a >> b;
    edg[a].push_back(b);
    edg[b].push_back(a);
  }
  long long max_deg = 0;
  memset(vis, 0, sizeof(vis));
  for (i = 1; i <= n; i++) {
    max_deg = max(max_deg, (long long)edg[i].size());
  }
  colors = max_deg + 1;
  memset(colarr, 0, sizeof(colarr));
  colarr[1] = 1;
  dfs(1, 0);
  cout << colors << endl;
  for (i = 1; i <= n; i++) {
    cout << colarr[i] << " ";
  }
  return 0;
}
