#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 1;
vector<int> G[MAXN];
int p[MAXN], ans;
void dfs(int u, int parent) {
  for (int v : G[u])
    if (v != parent) {
      dfs(v, u);
      if (p[v] == v) {
        swap(p[v], p[u]);
        ans += 2;
      }
    }
  if (p[u] == u && parent == 0) {
    int v = G[u][0];
    swap(p[u], p[v]);
    ans += 2;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }
  iota(p + 1, p + n + 1, 1);
  dfs(1, 0);
  cout << ans << '\n';
  for (int u = 1; u <= n; ++u) cout << p[u] << ' ';
  cout << '\n';
  return 0;
}
