#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmax(T &first, T second) {
  first < second ? first = second : T();
}
template <typename T>
void chkmin(T &first, T second) {
  first > second ? first = second : T();
}
template <typename T>
void readint(T &first) {
  first = 0;
  int f = 1;
  char c;
  for (c = getchar(); !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) first = first * 10 + c - '0';
  first *= f;
}
const int MAXN = 100005;
int n;
vector<int> G[MAXN], b[MAXN];
long long f[MAXN], g[MAXN];
int fa[MAXN], res[MAXN], to[MAXN];
int getfa(int u) { return u == fa[u] ? u : fa[u] = getfa(fa[u]); }
void dfs1(int u, int pa) {
  int t = 1 << 30;
  for (auto v : G[u]) {
    if (v == pa) continue;
    dfs1(v, u);
    g[u] += f[v];
    f[u] += min(g[v] + 1, f[v]);
    int s = min(g[v], f[v]) + 1 - min(g[v] + 1, f[v]);
    if (s < t) to[u] = v, t = s;
  }
  f[u] += t;
}
void dfs2(int u, int pa, int ty) {
  for (auto v : G[u]) {
    if (v == pa) continue;
    if (ty == 0)
      dfs2(v, u, 1);
    else {
      if (v == to[u] || g[v] + 1 <= f[v]) fa[getfa(u)] = getfa(v);
      if (g[v] + 1 <= f[v] || (v == to[u] && g[v] <= f[v]))
        dfs2(v, u, 0);
      else
        dfs2(v, u, 1);
    }
  }
}
int main() {
  int u, v;
  readint(n);
  for (int i = 1; i < n; ++i)
    readint(u), readint(v), G[u].push_back(v), G[v].push_back(u);
  for (int i = 1; i <= n; ++i) fa[i] = i;
  dfs1(1, -1);
  dfs2(1, -1, 1);
  for (int i = 1; i <= n; ++i) b[getfa(i)].push_back(i);
  for (int i = 1; i <= n; ++i)
    if (getfa(i) == i) {
      for (int j = 1; j < b[i].size(); ++j) res[b[i][j]] = b[i][j - 1];
      res[b[i][0]] = b[i].back();
    }
  printf("%d\n", 2 * f[1]);
  for (int i = 1; i <= n; ++i) printf("%d ", res[i]);
  return 0;
}
