#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
bool vis[N];
bool pro[N];
int p[N];
int pos[N];
int ans = 0;
void dfs(int u, int x, vector<int> adj[]) {
  vis[u] = 1;
  p[u] = x;
  for (int v : adj[u]) {
    if (!vis[v]) {
      if (u == 1) p[u] = v;
      dfs(v, u, adj);
    }
  }
  if (!pro[u]) {
    pro[u] = 1;
    swap(pos[u], pos[p[u]]);
    pro[p[u]] = 1;
    ans += 2;
  }
}
int main() {
  for (int i = 0; i < N; i++) pos[i] = i;
  int n;
  cin >> n;
  vector<int> adj[n + 1];
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0, adj);
  cout << ans << endl;
  for (int i = 1; i <= n; i++) cout << pos[i] << " ";
  cout << endl;
}
