#include <bits/stdc++.h>
using namespace std;
int MOD(int a, int b) {
  if (a > b)
    return a - b;
  else
    return b - a;
}
long long int max3(long long int a, long long int b, long long int c) {
  return max(c, max(a, b));
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int max(long long int a, long long int b) { return (a > b) ? a : b; }
long long int min(long long int a, long long int b) { return (a < b) ? a : b; }
long long int gcd(long long int a, long long int b) {
  if (b == 1)
    return 1;
  else if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
int ind = 1;
int deg[200005];
int col[200005];
vector<int> adj[200005];
bool vis[200005];
int par[200005];
int ctr = 1;
int n;
void dfs(int s) {
  vis[s] = true;
  vector<int>::iterator i;
  int ctr1 = 0;
  for (i = adj[s].begin(); i < adj[s].end(); i++) {
    if (!vis[*i]) {
      if (par[s] == -1) {
        col[*i] = ++ctr;
        par[*i] = s;
        dfs(*i);
      } else {
        ctr1++;
        if ((ctr1 != col[s]) && (ctr1 != col[par[s]])) {
          col[*i] = ctr1;
          par[*i] = s;
          dfs(*i);
        } else
          i--;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  memset(deg, 0, sizeof(deg));
  memset(vis, 0, sizeof(vis));
  int i, j, k;
  for (i = 1; i < n; i++) {
    cin >> j >> k;
    adj[j].push_back(k);
    adj[k].push_back(j);
    deg[j]++;
    deg[k]++;
    if (deg[j] > deg[ind]) ind = j;
    if (deg[k] > deg[ind]) ind = k;
  }
  ctr = 1;
  par[ind] = -1;
  col[ind] = 1;
  dfs(ind);
  cout << ctr << '\n';
  for (i = 1; i < n + 1; i++) cout << col[i] << " ";
  cout << '\n';
  return 0;
}
