#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > a((int)(2e5 + 1), vector<int>());
int ans[(int)(2e5 + 1)];
int val[(int)(2e5 + 1)];
int cost = 0;
void dfs(int s, int e) {
  vector<int> curr;
  for (auto x : a[s])
    if (x != e) {
      dfs(x, s);
      if (val[x] == 1) curr.push_back(x);
    }
  if (!curr.size()) {
    if (s == 1) {
      val[s] = 1;
      s = a[s][0];
      for (auto x : a[s])
        if (val[x] == 1) curr.push_back(x);
      cost -= 2 + (curr.size() - 2) * 2;
    } else {
      val[s] = 1;
      return;
    }
  }
  cost += 2 + (curr.size() - 1) * 2;
  int i;
  for (i = 0; i + 1 < curr.size(); i++) ans[curr[i]] = curr[i + 1];
  ans[curr.back()] = s;
  ans[s] = curr[0];
  val[s] = 2;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int i;
  for (i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  dfs(1, 0);
  cout << cost << '\n';
  for (i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << '\n';
}
