#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, tot, okay, M[N], P[N];
vector<int> Adj[N];
void DFS(int v, int p = 0) {
  vector<int> vec;
  for (int u : Adj[v])
    if (u != p) {
      DFS(u, v);
      if (!M[u]) vec.push_back(u);
    }
  if (!vec.size()) {
    if (p) return;
    swap(P[v], P[Adj[v][0]]);
    M[v] = 1;
    return;
  }
  tot++;
  M[v] = 1;
  for (int u : vec) swap(P[v], P[u]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int v, u;
    scanf("%d%d", &v, &u);
    Adj[v].push_back(u);
    Adj[u].push_back(v);
  }
  iota(P + 1, P + n + 1, 1);
  int root = 1;
  for (int i = 1; i <= n; i++)
    if ((int)Adj[i].size() == 1) root = i;
  DFS(root);
  tot = (n - tot) * 2;
  printf("%d\n", tot);
  for (int i = 1; i <= n; i++) printf("%d ", P[i]);
  printf("\n");
  return 0;
}
