#include <bits/stdc++.h>
using namespace std;
vector<int> edges[200005], vis(200005);
void bfs(int x) {
  vis[x] = 1;
  queue<pair<int, set<int> > > q;
  set<int> st;
  st.insert(1);
  q.push(make_pair(x, st));
  while (!q.empty()) {
    set<int> st = q.front().second;
    int u = q.front().first;
    q.pop();
    int clr = 1;
    for (int i = 0; i < edges[u].size(); i++) {
      int v = edges[u][i];
      if (vis[v] == 0) {
        while (st.find(clr) != st.end()) clr++;
        st.insert(clr);
        set<int> temp;
        for (int i = 0; i < edges[v].size(); i++) {
          if (vis[edges[v][i]]) {
            temp.insert(vis[edges[v][i]]);
          }
        }
        vis[v] = clr;
        temp.insert(clr);
        q.push({v, temp});
      }
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  bfs(0);
  int d = 0;
  for (int i = 0; i < n; i++) {
    d = max(d, (int)edges[i].size());
  }
  d++;
  cout << d << endl;
  for (int i = 0; i < n; i++) {
    cout << vis[i] << " ";
  }
  return 0;
}
