#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> v[n + 1];
  for (long long int i = 0; i < n - 1; i++) {
    long long int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  long long int c = 1;
  vector<long long int> vis(n + 1, 0);
  vector<long long int> d(n + 1, 0);
  vis[1] = 1;
  d[1] = 1;
  queue<long long int> q;
  q.push(1);
  while (!q.empty()) {
    map<long long int, long long int> mp;
    long long int x = q.front();
    q.pop();
    mp[d[x]]++;
    for (long long int i = 0; i < v[x].size(); i++) {
      if (vis[v[x][i]] == 1) {
        long long int k = v[x][i];
        mp[d[k]]++;
      }
    }
    long long int w = 1;
    for (long long int i = 0; i < v[x].size(); i++) {
      long long int k = v[x][i];
      if (vis[k] == 0) {
        vis[k] = 1;
        q.push(k);
        while (w) {
          if (mp[w] > 0)
            w++;
          else {
            mp[w]++;
            c = max(c, w);
            d[k] = w;
            break;
          }
        }
      }
    }
  }
  cout << c << endl;
  for (long long int i = 1; i <= n; i++) cout << d[i] << " ";
}
