#include <bits/stdc++.h>
using namespace std;
vector<int> edge[200002], col;
int vis[200002];
queue<int> q;
void bfs(int s) {
  vis[s] = 1;
  q.push(s);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    set<int> st;
    for (auto y : edge[x]) {
      if (vis[y]) {
        st.insert(col[y - 1]);
      }
    }
    if (col[x - 1] == -1) {
      int flag = 1;
      while (1) {
        if (st.find(flag) != st.end()) {
          flag++;
        } else {
          col[x - 1] = flag;
          break;
        }
      }
    }
    int start = col[x - 1] - 1, end = col[x - 1] + 1;
    for (auto y : edge[x]) {
      if (!vis[y]) {
        vis[y] = 1;
        q.push(y);
        int flag = 0;
        while (!flag) {
          if (start > 0) {
            if (st.find(start) != st.end()) {
              start--;
            } else {
              col[y - 1] = start;
              st.insert(start);
              start--;
              flag = 1;
            }
          } else {
            if (st.find(end) != st.end()) {
              end++;
            } else {
              col[y - 1] = end;
              st.insert(end);
              end++;
              flag = 1;
            }
          }
        }
      }
    }
  }
}
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    edge[x].push_back(y);
    edge[y].push_back(x);
  }
  col.assign(n, -1);
  for (int i = 1; i <= n; i++) {
    if (edge[i].size() > 1) {
      bfs(i);
      break;
    }
  }
  int mx = 1;
  for (auto x : col) {
    mx = max(x, mx);
  }
  cout << mx << "\n";
  for (auto x : col) {
    cout << x << " ";
  }
  cout << "\n";
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
