#include <bits/stdc++.h>
using namespace std;
vector<long long int> p[200005], vis(200005, 0);
long long int k = 0;
void dfs(long long int i, long long int t = -1, long long int c = 1,
         long long int pc = 0) {
  vis[i] = c;
  k = max(k, c);
  long long int x = 1;
  for (long long int j = 0; j < p[i].size(); j++) {
    if (p[i][j] != t) {
      while (x == c || x == pc) x++;
      dfs(p[i][j], i, x, c);
      x++;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n - 1; i++) {
    long long int x, z;
    cin >> x >> z;
    p[z].push_back(x);
    p[x].push_back(z);
  }
  dfs(1);
  cout << k << endl;
  for (long long int i = 1; i <= n; i++) cout << vis[i] << " ";
}
