#include <bits/stdc++.h>
using namespace std;
bool comp(pair<int, int> a, pair<int, int> b) {
  return (a.first == b.first) ? a.second < b.second : a.first < b.first;
}
long long int modInverse(long long int a) {
  long long int m = 1000000007;
  long long int y = 0, x = 1;
  while (a > 1) {
    long long int q = a / m;
    long long int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += 1000000007;
  return x;
}
long long int binpow(long long int a, long long int p) {
  if (p == 0) return 1;
  long long int ret = binpow(a, p / 2);
  ret *= ret;
  ret %= 1000000007;
  if (p % 2) {
    ret *= a;
    ret %= 1000000007;
  }
  return ret;
}
bool com(pair<int, int> a, pair<int, int> b) { return a.first >= b.first; }
const int N = 2e5 + 5;
vector<int> g[N];
vector<int> c(N, -1), p(N, -1);
void dfs(int i, int par) {
  p[i] = par;
  int j = 1;
  for (auto u : g[i]) {
    if (c[u] == -1) {
      while (j == c[i] || j == c[p[i]]) j++;
      c[u] = j++;
      dfs(u, i);
    }
  }
}
void solve(int tc) {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  c[1] = 1;
  dfs(1, 0);
  set<int> s;
  for (int i = 0; i < n; i++) s.insert(c[i + 1]);
  cout << s.size() << '\n';
  for (int i = 0; i < n; i++) cout << c[i + 1] << " ";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  for (int tc = 0; tc < t; tc++) {
    solve(tc + 1);
  }
}
