#include <bits/stdc++.h>
using namespace std;
vector<long long> g[200005];
long long col[200005], mcol;
bool bmas[200005];
void dfs(long long tgd) {
  bmas[tgd] = 1;
  set<long long> s;
  s.insert(col[tgd]);
  for (long long i = 0; i < g[tgd].size(); i++) s.insert(col[g[tgd][i]]);
  long long c = 1;
  for (long long i = 0; i < g[tgd].size(); i++) {
    if (col[g[tgd][i]] == 0) {
      while (s.count(c)) c++;
      mcol = max(mcol, c);
      col[g[tgd][i]] = c++;
    }
  }
  if (col[tgd] == 0) {
    col[tgd] = c;
    mcol = max(mcol, c);
  }
  for (long long i = 0; i < g[tgd].size(); i++)
    if (!bmas[g[tgd][i]]) dfs(g[tgd][i]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(1);
  cout << mcol << "\n";
  for (long long i = 1; i <= n; i++) cout << col[i] << " ";
  return 0;
}
