#include <bits/stdc++.h>
using adjacency_list = std::vector<std::vector<std::size_t>>;
constexpr std::size_t invalid = std::numeric_limits<std::size_t>::max();
int simple_swap_cost(adjacency_list const& adj, std::size_t v,
                     std::size_t parent, std::vector<std::size_t>& targets) {
  int cost = 0;
  std::vector<std::size_t> unassigned_children;
  for (std::size_t nb : adj[v]) {
    if (nb == parent) continue;
    cost += simple_swap_cost(adj, nb, v, targets);
    if (targets[nb] == invalid) unassigned_children.push_back(nb);
  }
  if (!unassigned_children.empty()) {
    targets[v] = unassigned_children.front();
    for (std::size_t i = 1; i < unassigned_children.size(); ++i)
      targets[unassigned_children[i - 1]] = unassigned_children[i];
    targets[unassigned_children.back()] = v;
  }
  cost += static_cast<int>(unassigned_children.size() * 2);
  return cost;
}
int main() {
  std::size_t n;
  std::cin >> n;
  adjacency_list adj(n);
  for (std::size_t i = 0; i < n - 1; ++i) {
    std::size_t u, v;
    std::cin >> u >> v;
    --u;
    --v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  std::vector<std::size_t> targets(n, invalid);
  int cost = simple_swap_cost(adj, 0, 0, targets);
  for (std::size_t v = 0; v < n; ++v)
    if (targets[v] == invalid) {
      cost += 2;
      std::size_t nb = adj[v].front();
      targets[v] = targets[nb];
      targets[nb] = v;
    }
  std::cout << cost << '\n';
  for (std::size_t t : targets) std::cout << t + 1 << ' ';
  return 0;
}
