#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 1e5 + 5;
int n, x, y, ans, dp[maxn], now[maxn];
vector<int> E[maxn];
void dfs(int nd, int pr) {
  int num = 0;
  for (auto i : E[nd]) {
    if (i != pr) {
      dfs(i, nd);
      if (dp[i] == 1) {
        num++;
        swap(now[nd], now[i]);
        ans += 2;
      }
    }
  }
  if (num == 0) dp[nd] = 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) now[i] = i;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    E[x].push_back(y);
    E[y].push_back(x);
  }
  dfs(1, 0);
  if (dp[1]) {
    ans += 2;
    swap(now[1], now[E[1][0]]);
  }
  cout << ans << '\n';
  for (int i = 1; i <= n; i++) cout << now[i] << ' ';
}
