#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5;
long long par[maxn];
long long pred[maxn];
vector<long long> g[maxn];
long long dp[maxn][2];
pair<vector<pair<long long, long long>>, long long> from[maxn][2];
long long res[maxn];
void calc(long long v, long long p) {
  pred[v] = p;
  vector<pair<long long, long long>> a;
  vector<long long> gg;
  for (long long i = 0; i < g[v].size(); ++i) {
    long long to = g[v][i];
    if (p == to) continue;
    calc(to, v);
    a.push_back({dp[to][0], dp[to][1]});
    gg.push_back(to);
  }
  long long sum0 = 0;
  vector<pair<long long, long long>> fr(a.size());
  for (long long j = 0; j < a.size(); ++j) {
    if (a[j].first > a[j].second)
      fr[j] = {0, gg[j]};
    else
      fr[j] = {1, gg[j]};
    sum0 += max(a[j].first, a[j].second);
  }
  long long id1 = -1;
  long long mx = -1e9;
  for (long long k = 0; k < a.size(); ++k) {
    long long now = sum0 - max(a[k].first, a[k].second) + a[k].first;
    if (mx < now) {
      mx = now;
      id1 = k;
    }
  }
  long long sum1 = mx;
  dp[v][0] = sum0;
  from[v][0] = {fr, -1};
  if (id1 != -1) {
    fr[id1] = {0, gg[id1]};
    dp[v][1] = sum1 + 1;
    from[v][1] = {fr, id1};
  } else
    dp[v][1] = -1e9;
}
void make_ans(long long v, long long type) {
  if (type == 1) {
    par[v] = from[v][type].first[from[v][type].second].second;
    par[from[v][type].first[from[v][type].second].second] = v;
    swap(res[v], res[from[v][type].first[from[v][type].second].second]);
  }
  for (long long i = 0; i < from[v][type].first.size(); ++i) {
    long long to = from[v][type].first[i].second;
    long long typ = from[v][type].first[i].first;
    make_ans(to, typ);
  }
}
long long calcParsoch() {
  calc(0, -1);
  if (dp[0][0] > dp[0][1]) {
    make_ans(0, 0);
    return dp[0][0];
  } else {
    make_ans(0, 1);
    return dp[0][1];
  }
}
void dfs(long long v, long long p) {
  pred[v] = p;
  for (long long i = 0; i < g[v].size(); ++i) {
    long long to = g[v][i];
    if (to != p) dfs(to, v);
  }
}
signed main() {
  cin.tie();
  cout.tie();
  ios_base::sync_with_stdio(false);
  for (long long k = 0; k < maxn; ++k) {
    par[k] = -1;
  }
  long long n;
  cin >> n;
  for (long long i = 0; i < n - 1; ++i) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (long long m = 0; m < n; ++m) {
    res[m] = m;
  }
  long long ans = calcParsoch();
  ans = n + (n - ans * 2);
  cout << ans << "\n";
  long long ver = 0;
  for (long long j = 0; j < n; ++j) {
    if (par[j] != -1) ver = j;
  }
  dfs(ver, -1);
  for (long long l = 0; l < n; ++l) {
    if (par[l] == -1) {
      swap(res[pred[l]], res[l]);
    }
  }
  for (long long i = 0; i < n; ++i) {
    cout << res[i] + 1 << " ";
  }
}
