#include <bits/stdc++.h>
using namespace std;
struct node {
  int house = 0;
  int path = 0;
};
void dfs(vector<vector<int> > &edges, vector<node> &ans, int curr = 1,
         int par = 0) {
  if (edges[curr].size() == 1 && edges[curr][0] == par) {
    return;
  }
  int next;
  vector<int> v;
  for (int i = 0; i < edges[curr].size(); i++) {
    next = edges[curr][i];
    if (next == par) {
      continue;
    }
    dfs(edges, ans, next, curr);
    ans[curr].path += ans[next].path;
    if (!ans[next].house) {
      v.push_back(next);
    }
  }
  if (v.size() == 0) {
    return;
  }
  ans[curr].path += v.size() * 2;
  while (v.size() > 2) {
    ans[v[v.size() - 1]].house = v[v.size() - 2];
    ans[v[v.size() - 2]].house = v[v.size() - 1];
    v.pop_back(), v.pop_back();
  }
  if (v.size() == 2) {
    ans[v[0]].house = v[1];
    ans[v[1]].house = curr;
    ans[curr].house = v[0];
  } else if (v.size() == 1) {
    ans[v[0]].house = curr;
    ans[curr].house = v[0];
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, a, b;
  cin >> n;
  vector<vector<int> > edges(n + 1);
  vector<node> ans(n + 1);
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  dfs(edges, ans);
  if (ans[1].house == 0) {
    int next = edges[1][0];
    ans[1].house = ans[next].house;
    ans[next].house = 1;
    ans[1].path += 2;
  }
  cout << ans[1].path << "\n";
  for (int i = 1; i <= n; i++) {
    cout << ans[i].house << " ";
  }
  return 0;
}
