#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v(200005);
vector<int> vis(200005);
vector<int> col(200005);
vector<int> par(200005);
void dfs(int src, int colx) {
  stack<int> st;
  vis[src] = 1;
  col[src] = 1;
  for (int i = 0; i < v[src].size(); i++) {
    st.push(v[src][i]);
    col[v[src][i]] = col[src] + i + 1;
    par[v[src][i]] = src;
  }
  while (!st.empty()) {
    int x = st.top();
    st.pop();
    if (!vis[x]) {
      vis[x] = 1;
    }
    int j = 1;
    int px = col[par[x]];
    int cx = col[x];
    for (int i = 0; i < v[x].size(); i++) {
      if (vis[v[x][i]] == 0) {
        par[v[x][i]] = x;
        st.push(v[x][i]);
        while (j == px || j == cx) j++;
        col[v[x][i]] = j;
        j++;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  fill(vis.begin(), vis.end(), 0);
  for (int i = 0; i < v.size(); i++) v[i].clear();
  map<int, int> mp;
  int star = 0;
  int mx = 0;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
    mp[x]++;
    mp[y]++;
    if (mx < mp[x]) mx = mp[x];
    if (mx < mp[y]) mx = mp[y];
  }
  dfs(1, mx + 1);
  cout << mx + 1 << endl;
  for (int i = 1; i <= n; i++) cout << col[i] << " ";
}
