#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  scanf("%d", &n);
  vector<vector<int> > adj(n + 1, vector<int>()),
      independentChildren(n + 1, vector<int>());
  vector<int> isIndependent(n + 1, 1), ans(n + 1, 0), par(n + 1, 0), order;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  if (n == 2) {
    puts("2");
    puts("2 1");
    exit(0);
  }
  for (a = 1; adj[a].size() == 1; ++a)
    ;
  queue<int> q;
  ans[a] = 1;
  q.push(a);
  order.push_back(a);
  while (q.size()) {
    a = q.front();
    q.pop();
    for (int x : adj[a]) {
      if (!ans[x]) {
        ans[x] = 1;
        par[x] = a;
        q.push(x);
        order.push_back(x);
      }
    }
  }
  b = 0;
  while (order.size()) {
    a = order.back();
    order.pop_back();
    if (!isIndependent[a]) continue;
    if (par[a] != 0) {
      isIndependent[par[a]] = 0;
      independentChildren[par[a]].push_back(a);
    } else {
      independentChildren[adj[a][0]].push_back(a);
    }
    b += 2;
  }
  for (int i = 1; i <= n; ++i) {
    if (independentChildren[i].size()) {
      a = i;
      for (int x : independentChildren[i]) {
        ans[x] = a;
        a = x;
      }
      ans[i] = a;
    }
  }
  printf("%d\n", b);
  for (int i = 1; i < n; ++i) printf("%d ", ans[i]);
  printf("%d\n", ans[n]);
}
