#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
vector<int> nums;
vector<int> nodos;
int cont = 0;
int dfs(int u, int p) {
  int f = 1;
  for (auto v : adj[u]) {
    if (v != p) {
      int f1 = dfs(v, u);
      if (f1 == 1) {
        cont += 2;
        swap(nums[u], nums[v]);
        f = 0;
      }
    }
  }
  return f;
}
int main() {
  int n;
  cin >> n;
  adj.assign(n, vector<int>());
  nums.resize(n);
  iota(nums.begin(), nums.end(), 0);
  int u, v;
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    adj[u - 1].push_back(v - 1);
    adj[v - 1].push_back(u - 1);
  }
  int f1 = dfs(0, -1);
  if (f1 == 1) {
    cont += 2;
    swap(nums[0], nums[adj[0][0]]);
  }
  cout << cont << endl;
  for (int i = 0; i < n; i++) cout << nums[i] + 1 << " ";
  cout << endl;
}
