#include <bits/stdc++.h>
using namespace std;
const int maxN = 100003;
vector<int> adj[maxN];
vector<int> pos(maxN);
int ans = 0;
void dfs(int node, int parent) {
  for (auto v : adj[node]) {
    if (v != parent) {
      dfs(v, node);
    }
  }
  for (auto v : adj[node]) {
    if (v != parent) {
      if (pos[v] == v) {
        swap(pos[v], pos[node]);
        ans += 2;
      }
    }
  }
  if (pos[node] == node && node == 1) {
    for (auto v : adj[node]) {
      if (v != parent) {
        swap(pos[v], pos[node]);
        ans += 2;
        break;
      }
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) pos[i] = i;
  dfs(1, 0);
  cout << ans << "\n";
  for (int i = 1; i <= n; i++) cout << pos[i] << " ";
  return 0;
}
