#include <bits/stdc++.h>
using namespace std;
vector<int> adj[200002];
int q[200002];
void dfs(int v, int par) {
  int now = 0;
  for (auto i : adj[v]) {
    if (i != par) {
      while (now == q[v] || now == q[par]) now++;
      q[i] = now++;
      dfs(i, v);
    }
  }
}
int main() {
  int n;
  cin >> n;
  int maxn = 0;
  memset(q, 0, sizeof(q));
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 0; i < n; i++) {
    int c = adj[i].size();
    maxn = max(maxn, c);
  }
  cout << maxn + 1 << endl;
  dfs(0, 0);
  for (int i = 0; i < n; i++) {
    cout << q[i] + 1 << " ";
  }
  return 0;
}
