#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int N = 200006;
long long int n;
vector<long long int> adj[N];
vector<long long int> color;
long long int ans = 1;
long long int power(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n % 2 == 1) res = (res * x) % mod;
    x = (x * x) % mod;
    n /= 2;
  }
  return res;
}
void dfs(long long int v, long long int p) {
  long long int c = 1;
  for (auto x : adj[v]) {
    if (x == p) continue;
    while (c == color[v] || c == color[p]) c++;
    color[x] = c++;
    ans = max(ans, c);
    dfs(x, v);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  color.resize(n, 0);
  long long int i, j, k;
  for (i = 1; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  color[0] = 1;
  dfs(0, -1);
  cout << ans - 1 << "\n";
  for (i = 0; i < color.size(); i++) cout << color[i] << " ";
}
