#include <bits/stdc++.h>
using namespace std;
vector<int> v[100100];
vector<int> ans(100100);
int br[100100];
int n, res;
bool m[100100];
void dfs(int pos, int par) {
  for (int i : v[pos]) {
    if (i != par) {
      dfs(i, pos);
    }
  }
  if (!m[pos] && par != -1) {
    res += 2;
    m[pos] = 1;
    m[par] = 1;
    swap(ans[pos], ans[par]);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
    ++br[a];
    ++br[b];
  }
  for (int i = 1; i <= n; ++i) ans[i] = i;
  dfs(1, -1);
  if (!m[1]) {
    res += 2;
    swap(ans[1], ans[v[1][0]]);
  }
  cout << res << endl;
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
