#include <bits/stdc++.h>
using namespace std;
inline long long modExp(long long a, long long b, long long m = 998244353) {
  long long res = 1;
  a %= m;
  while (b >= 1) {
    if (b % 2 != 0) {
      res = (res % m * a % m) % m;
    }
    a = (a % m * a % m) % m;
    b = b / 2;
  }
  return res;
}
void dfs(vector<vector<long long>> &adj, vector<long long> &color,
         long long curr, long long c, long long p) {
  color[curr] = c;
  long long toColor = 1;
  for (auto i : adj[curr]) {
    if (color[i] == -1) {
      while (toColor == c || toColor == p) toColor++;
      dfs(adj, color, i, toColor++, c);
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n;
  cin >> n;
  vector<vector<long long>> adj(n + 1);
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  vector<long long> color(n + 1, -1);
  long long curr = 1;
  dfs(adj, color, 1, curr, 0);
  cout << *max_element(color.begin(), color.end()) << "\n";
  for (long long i = 1; i < color.size(); i++) {
    cout << color[i] << " ";
  }
  cout << "\n";
  return 0;
}
