#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll INF = 1e18;
const ll max(ll x, ll y) { return (x > y) ? x : y; }
const ll min(ll x, ll y) { return (x < y) ? x : y; }
ll n;
vector<vector<ll> > adjList;
vector<ll> perm;
vector<vector<ll> > dist;
vector<ll> p;
vector<set<ll> > c;
vector<ll> topsort;
void DFS(ll v) {
  topsort.push_back(v);
  for (auto u : adjList[v]) {
    if (u != p[v]) {
      p[u] = v;
      c[v].insert(u);
      DFS(u);
    }
  }
}
void get_perm() {
  reverse(topsort.begin(), topsort.end());
  vector<ll> perm;
  for (ll i = 0; n > i; i++) perm.push_back(i);
  ll ans = 0;
  for (auto v : topsort) {
    if (perm[v] == v) {
      if (v != 0)
        swap(perm[v], perm[p[v]]);
      else
        swap(perm[v], perm[*c[0].begin()]);
      ans += 2;
    }
  }
  cout << ans << endl;
  for (auto i : perm) cout << i + 1 << " ";
}
int main() {
  cin >> n;
  adjList.resize(n);
  p.assign(n, -1);
  c.resize(n);
  for (ll i = 0; n - 1 > i; i++) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    adjList[a].push_back(b);
    adjList[b].push_back(a);
  }
  DFS(0);
  get_perm();
}
