#include <bits/stdc++.h>
using namespace std;
vector<int> v[200001];
bool vis[200001];
int bla;
int co[200001];
int fath[200001];
int n, m, a, b;
int ma = 0;
void bfs(int s) {
  int s1;
  queue<int> q;
  q.push(s);
  fath[s] = 0;
  vis[s] = 1;
  co[s] = 1;
  while (!q.empty()) {
    s1 = 1;
    int p = q.front();
    q.pop();
    for (int i = 0; i < v[p].size(); i++) {
      if (!vis[v[p][i]]) {
        fath[v[p][i]] = p;
        q.push(v[p][i]);
        vis[v[p][i]] = true;
        if (co[fath[v[p][i]]] != s1 && co[fath[fath[v[p][i]]]] != s1) {
          co[v[p][i]] = s1;
          if (s1 > ma) ma = s1;
        } else if (co[fath[v[p][i]]] != s1 + 1 &&
                   co[fath[fath[v[p][i]]]] != s1 + 1) {
          s1++;
          co[v[p][i]] = s1;
          if (s1 > ma) ma = s1;
        } else {
          s1 += 2;
          co[v[p][i]] = s1;
          if (s1 > ma) ma = s1;
        }
        s1++;
      }
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  bfs(1);
  cout << ma << endl;
  for (int i = 1; i <= n; i++) cout << co[i] << " ";
  return 0;
}
