#include <bits/stdc++.h>
using namespace std;
long long int vis[1100005] = {0};
std::vector<long long int> v[1100005];
long long int col[1100005] = {0};
long long int c = 0, maxm = -1;
void dfs(long long int u, long long int par) {
  long long int p = 1;
  for (long long int ch : v[u]) {
    if (ch == par) continue;
    while (col[u] == p || col[par] == p) p++;
    col[ch] = p++;
    dfs(ch, u);
  }
}
long long int power(long long int x, long long int y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return power(x, y / 2) * power(x, y / 2);
  else
    return x * power(x, y / 2) * power(x, y / 2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    long long int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  col[1] = 1;
  dfs(1, 0);
  set<long long int> st;
  for (int i = 1; i <= n; i++) {
    st.insert(col[i]);
  }
  cout << st.size() << endl;
  for (int i = 1; i <= n; i++) cout << col[i] << " ";
  return 0;
}
