#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
vector<int> adj[N];
int n, k, col[N];
void dfs(int u, int par) {
  int c = 0;
  for (auto v : adj[u])
    if (v ^ par) {
      if (c == min(col[u], col[par])) c++;
      if (c == max(col[u], col[par])) c++;
      k = max(k, col[v] = c++);
      dfs(v, u);
    }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(0, 0);
  cout << ++k << endl;
  for (int i = 0; i < n; i++) cout << ++col[i] << ' ';
}
