#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535;
int main() {
  long long int n, a, b, maxcnt = INT_MIN;
  cin >> n;
  vector<long long int> v[n + 1];
  vector<long long int> mark(n + 1, 0);
  map<long long int, long long int> mp;
  for (long long int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  queue<long long int> q;
  q.push(1);
  while (!q.empty()) {
    long long int top = q.front();
    mark[top] = 1;
    q.pop();
    set<long long int> s;
    if (mp[top] != 0) s.insert(mp[top]);
    for (long long int j = 0; j < v[top].size(); j++) {
      if (mark[v[top][j]] == 0) q.push(v[top][j]);
      if (mp[v[top][j]] != 0) s.insert(mp[v[top][j]]);
    }
    long long int cnt = 1;
    if (mp[top] == 0) {
      while (s.find(cnt) != s.end()) {
        cnt++;
      }
      mp[top] = cnt;
      s.insert(cnt);
    }
    for (long long int j = 0; j < v[top].size(); j++) {
      if (mp[v[top][j]] == 0) {
        while (s.find(cnt) != s.end()) {
          cnt++;
        }
        mp[v[top][j]] = cnt;
        s.insert(cnt);
      }
    }
    maxcnt = max(cnt, maxcnt);
  }
  cout << maxcnt << endl;
  for (long long int i = 1; i < n + 1; i++) {
    cout << mp[i] << " ";
  }
  cout << endl;
}
