#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
vector<vector<int> > v;
vector<int> col;
int ans = -1;
void dfs(int node, int par) {
  ans = max(ans, 1 + (int)v[node].size());
  for (auto c : v[node]) {
    if (c == par) continue;
    dfs(c, node);
  }
}
void colour(int node, int par) {
  int a = col[node], b = col[par], k = 1;
  for (auto to : v[node]) {
    while (k == a || k == b) k++;
    if (to == par) continue;
    if (col[to] == -1) col[to] = k;
    k++;
  }
  for (auto child : v[node]) {
    if (child == par) continue;
    colour(child, node);
  }
}
void solve() {
  int n;
  cin >> n;
  v.resize(n + 1);
  col.resize(n + 1, -1);
  int a, b;
  for (long long i = 0; i < n - 1; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs(1, -1);
  col[1] = 1;
  col[0] = -2;
  colour(1, 0);
  cout << ans << "\n";
  for (long long i = 1; i < n + 1; i++) cout << col[i] << " ";
  cout << "\n";
}
int main() {
  bool take_test_cases = 0;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  if (take_test_cases) {
    int t;
    cin >> t;
    while (t--) solve();
  } else
    solve();
}
