#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
int mxN = 2e5 + 7;
int n;
vector<vector<int>> adj(mxN);
vector<int> parent(mxN);
vector<int> c(mxN);
vector<int> vis(mxN);
int colours = 0;
void bfs() {
  queue<int> q;
  q.push(1);
  c[1] = 1;
  vis[1] = 1;
  while (!q.empty()) {
    int cur = q.front();
    q.pop();
    int temp_colour = 1;
    for (int x : adj[cur]) {
      if (!vis[x]) {
        vis[x] = 1;
        while (temp_colour == c[cur] || temp_colour == c[parent[cur]]) {
          temp_colour++;
        }
        c[x] = temp_colour++;
        parent[x] = cur;
        q.push(x);
      }
    }
  }
}
void solve() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    colours =
        max({colours, (int)(adj[u].size() + 1), (int)(adj[v].size() + 1)});
  }
  bfs();
  cout << colours << "\n";
  for (int i = 1; i <= n; i++) {
    cout << c[i] << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
