#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
vector<int> adj[300001];
vector<int> color(300001, -1);
vector<int> vis(300001, 0);
void dfs(int s, int sc, int gc) {
  vis[s] = 1;
  int j = 1;
  for (auto u : adj[s])
    if (!vis[u]) {
      while (j == sc || j == gc) j++;
      color[u] = j;
      dfs(u, j, sc);
      j++;
    }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a, b;
  for (int i = 0; i < n - 1; ++i) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  color[1] = 1;
  dfs(1, 1, -1);
  cout << *max_element(color.begin(), color.end()) << endl;
  for (int i = 1; i <= n; i++) cout << color[i] << " ";
}
