#include <bits/stdc++.h>
using namespace std;
inline void boost() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int N = int(1e5) + 5;
const int INF = int(1e9) + 7;
const long long MINF = 1e18;
int n;
bool used[N * 2];
vector<int> g[N * 2];
int ans[N * 2];
int maxi = -1;
void dfs(int v, int c) {
  ans[v] = c;
  used[v] = 1;
  set<int> s;
  int oo = g[v].size();
  maxi = max(oo + 1, maxi);
  for (int i = 1; i <= g[v].size() + 1; i++) {
    s.insert(i);
  }
  for (int i = 0; i < g[v].size(); i++) {
    if (used[g[v][i]] == 1) {
      s.erase(ans[g[v][i]]);
    }
  }
  s.erase(c);
  for (int i = 0; i < g[v].size(); i++) {
    if (used[g[v][i]] == 0) {
      int uu = *s.begin();
      s.erase(uu);
      dfs(g[v][i], uu);
    }
  }
}
int main() {
  boost();
  cin >> n;
  for (int i = 1; i < n; i++) {
    int l, r;
    cin >> l >> r;
    g[l].push_back(r);
    g[r].push_back(l);
  }
  dfs(1, 1);
  cout << maxi << endl;
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
