#include <bits/stdc++.h>
const int M = 1e9 + 7, N = 2 * 1e5 + 3;
using namespace std;
int f[N], n, sum;
vector<long long> v[N];
void dfs(int i, int j) {
  for (auto l : v[i]) {
    if (l == j) continue;
    dfs(l, i);
  }
  if (f[i] == i) {
    sum += 2;
    if (j)
      swap(f[i], f[j]);
    else
      swap(f[i], f[v[i][0]]);
  }
}
int main() {
  cin >> n;
  for (int i = 1, x, y; i < n; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) f[i] = i;
  dfs(1, 0);
  cout << sum << "\n";
  for (int i = 1; i <= n; i++) cout << f[i] << " ";
  return 0;
}
