#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int s = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return s;
}
const int N = 2e5 + 5;
int n;
vector<int> G[N];
int deg[N], a[N], b[N];
int ans = 0;
void dfs(int u, int f) {
  for (int v : G[u]) {
    if (v == f) continue;
    dfs(v, u);
  }
  if (!f) {
    if (u == a[u]) {
      swap(a[u], a[G[u][0]]);
      ans += 2;
    }
  } else {
    if (u == a[u]) {
      swap(a[u], a[f]);
      ans += 2;
    }
  }
}
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    G[u].push_back(v);
    G[v].push_back(u);
    deg[u]++;
    deg[v]++;
  }
  if (n == 2) {
    printf("2\n2 1");
    return 0;
  }
  int rt = 0;
  for (int i = 1; i <= n; i++) {
    if (deg[i] > 1) rt = i;
    a[i] = i;
  }
  dfs(rt, 0);
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) b[a[i]] = i;
  for (int i = 1; i <= n; i++) printf("%d ", b[i]);
  return 0;
}
