#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
using si = short int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
void dfs(int v, vector<vector<int>>& gr, vector<int>& a, int p = 0) {
  int j = 0;
  for (int i : gr[v]) {
    if (i == p) continue;
    while (j == a[v] || j == a[p]) ++j;
    a[i] = j;
    dfs(i, gr, a, v);
    ++j;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> arr(n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    arr[a].push_back(b);
    arr[b].push_back(a);
  }
  int ma = 0;
  for (int i = 0; i < n; ++i) {
    ma = max(ma, (int)arr[i].size());
  }
  if (ma < 2) {
    cout << 1;
    return 0;
  }
  cout << ma + 1 << endl;
  vector<int> ans(n);
  dfs(0, arr, ans);
  for (int i : ans) cout << i + 1 << " ";
}
