#include <bits/stdc++.h>
using namespace std;
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
const long long MAXN = 1e6 + 10;
const long long INF = 8e18;
const long long MOD = 1e9 + 7;
long long deg[MAXN] = {0};
queue<long long> lf;
vector<long long> adj[MAXN];
long long A[MAXN], ans = 0;
void dfs(long long v, long long p) {
  for (long long u : adj[v])
    if (u != p) dfs(u, v);
  if (A[v] == v) {
    ans += 2;
    if (p)
      swap(A[v], A[p]);
    else
      swap(A[v], A[adj[v][0]]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (int i = 0; i <= n; i++) A[i] = i;
  for (int i = 1; i <= n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    deg[u]++;
    deg[v]++;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0);
  cout << ans << '\n';
  for (int i = 1; i <= n; i++) cout << A[i] << ' ';
  cout << '\n';
  return 0;
}
