#include <bits/stdc++.h>
using namespace std;
vector<int> adj[200010];
int a[200010];
bool mark[200010];
long long ans;
void DFS(int v, int jad) {
  mark[v] = true;
  ans = max(ans, (long long)(adj[v].size() + 1));
  int pt = 1;
  for (int i = 0; i < adj[v].size(); i++) {
    if (!mark[adj[v][i]]) {
      while (pt == a[jad] || pt == a[v]) pt++;
      a[adj[v][i]] = pt;
      pt++;
      DFS(adj[v][i], v);
    }
  }
}
int main() {
  int n, x, y;
  ;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  mark[1] = true;
  a[1] = 1;
  ans = adj[1].size() + 1;
  for (int i = 0; i < adj[1].size(); i++) {
    a[adj[1][i]] = i + 2;
    DFS(adj[1][i], 1);
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
}
