#include <bits/stdc++.h>
using namespace std;
vector<int> adj[200005];
bool visited[200005] = {false};
int colour[200005] = {0};
void DFS(int i, int p, int k) {
  if (visited[i] == true)
    return;
  else {
    visited[i] = true;
    int pi = 1;
    for (vector<int>::iterator j = adj[i].begin(); j < adj[i].end(); j++) {
      if (visited[*j] == false) {
        for (; pi <= k; pi++) {
          if (pi != colour[i] && pi != colour[p]) break;
        }
        colour[*j] = pi;
        pi++;
        DFS(*j, i, k);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long x, y;
  for (long long i = 1; i < n; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  long long z = 0;
  for (long long i = 1; i < n + 1; i++) {
    z = ((z > adj[i].size() + 1) ? (z) : (adj[i].size() + 1));
  }
  colour[1] = 1;
  DFS(1, 0, z);
  cout << z << endl;
  for (long long i = 1; i < n + 1; i++) cout << colour[i] << " ";
}
