#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<int> e[N], f[N];
int vfa[N], n, ans, p[N], q[N], vis[N];
void dfs1(int x, int fa) {
  for (auto i : e[x])
    if (i != fa) dfs1(i, x);
  if (!vis[x]) {
    if (fa) {
      f[x].push_back(fa);
      f[fa].push_back(x);
      vis[x] = vis[fa] = 1;
    } else {
      f[e[x][0]].push_back(x);
      f[x].push_back(e[x][0]);
    }
    ++ans;
  }
}
void dfs2(int x) {
  q[++*q] = x;
  vis[x] = 1;
  for (auto i : f[x])
    if (!vis[i]) dfs2(i);
}
int main() {
  scanf("%d", &n);
  for (int i = (int)(1); i <= (int)(n - 1); i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
  dfs1(1, 0);
  memset(vis, 0, sizeof(vis));
  for (int i = (int)(1); i <= (int)(n); i++)
    if (!vis[i]) {
      *q = 0;
      dfs2(i);
      for (int j = (int)(1); j <= (int)(*q); j++) p[q[j]] = q[j % (*q) + 1];
    }
  printf("%d\n", ans * 2);
  for (int i = (int)(1); i <= (int)(n); i++) printf("%d ", p[i]);
}
