#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ", ";
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? ", " : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
int n, ans;
vector<vector<int>> graph(112345);
vector<int> finPos(112345);
vector<int> invPos(112345);
bool dfs(int index, int par) {
  bool done = false;
  finPos[index] = index;
  for (int a = 0; a < graph[index].size(); a++) {
    if (graph[index][a] == par) continue;
    bool childDone = dfs(graph[index][a], index);
    if (!childDone) {
      finPos[graph[index][a]] = finPos[index];
      finPos[index] = graph[index][a];
      ans += 2;
      done = true;
    }
  }
  return done;
}
void solve() {
  cin >> n;
  ans = 0;
  int x, y;
  for (int a = 0; a < n - 1; a++) {
    cin >> x >> y;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  bool done = dfs(1, -1);
  if (!done) {
    finPos[1] = finPos[graph[1][0]];
    finPos[graph[1][0]] = 1;
    ans += 2;
  }
  cout << ans << '\n';
  for (int a = 1; a <= n; a++) {
    invPos[finPos[a]] = a;
  }
  for (int a = 1; a <= n; a++) {
    if (a > 1) cout << " ";
    cout << invPos[a];
  }
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt = 1;
  while (tt--) {
    solve();
  }
  return 0;
}
