#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
int isprime(long long int n) {
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
long long int fpow(long long int a, long long int b) {
  return b ? fpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1;
}
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
string lower(string s) {
  for (int i = 0; i < s.length(); i++) s[i] = tolower(s[i]);
  return s;
}
int n;
vector<int> adj[200009];
set<int> v[200009];
int vis[200009] = {0};
int col[200009] = {0};
int done[200009] = {0};
map<string, long long int> mpp;
long long int ans = 0;
void dfs(int s, int p) {
  int c = 1;
  for (int u : adj[s]) {
    if (u != p) {
      if (c != col[p] && c != col[s]) {
        col[u] = c;
        c++;
      } else {
        c++;
        if (c != col[p] && c != col[s]) {
          col[u] = c;
          c++;
        } else {
          c++;
          col[u] = c;
          c++;
        }
      }
    }
  }
  for (int u : adj[s]) {
    if (u != p) {
      dfs(u, s);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T = 1;
  long long int k, m = 0;
  string s1, s2, s3;
  long long int x, y = 0, z = 0, b, l = 0, r = 0, i, pos, t;
  long long int rel[10009] = {0};
  map<long long int, long long int> mp;
  while (T--) {
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
      cin >> x >> y;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    for (int i = 1; i <= n; i++)
      if (adj[i].size() > ans) ans = adj[i].size();
    ans++;
    cout << ans << endl;
    col[1] = 1;
    int c = 2;
    for (int u : adj[1]) {
      col[u] = c;
      c++;
      dfs(u, 1);
    }
    for (int i = 1; i <= n; i++) cout << col[i] << " ";
  }
  return 0;
}
