#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    que;
stringstream ssin;
const long long LINF = 0x7fffffffffffffffll;
const int N = 4e5 + 5, M = 4e5 + 5, mod = 1e9 + 7, INF = 0x3f3f3f3f;
int n, idx, sum;
int e[M], ne[M], h[N], ans[N];
inline long long read() {
  char c = getchar();
  long long x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
void add(int a, int b) {
  e[idx] = b;
  ne[idx] = h[a];
  h[a] = idx++;
}
void dfs(int u, int fa) {
  for (int i = h[u]; ~i; i = ne[i]) {
    int v = e[i];
    if (v == fa) continue;
    dfs(v, u);
  }
  if (fa != -1) {
    if (ans[u] == u) {
      swap(ans[u], ans[fa]);
      sum += 2;
    }
  }
}
int main() {
  n = read();
  memset(h, -1, sizeof h);
  ;
  for (int i = 1; i < n; ++i) {
    ans[i] = i;
    int a, b;
    a = read();
    b = read();
    add(a, b);
    add(b, a);
  }
  ans[n] = n;
  dfs(1, -1);
  if (ans[1] == 1) {
    sum += 2;
    for (int i = h[1]; ~i; i = ne[i]) {
      int v = e[i];
      swap(ans[1], ans[v]);
      break;
    }
  }
  cout << sum << '\n';
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
  puts("");
}
