#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 2000000000;
const long long BIG = 1446803456761533460LL;
const int maxn = 100010;
int n, sum, vil[maxn], ivil[maxn];
vector<int> g[maxn];
void dfs(int x, int par) {
  for (auto y : g[x])
    if (y != par) {
      dfs(y, x);
      if (vil[y] == y) swap(vil[y], vil[x]), sum += 2;
    }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    g[a].emplace_back(b), g[b].emplace_back(a);
  }
  iota(vil, vil + n + 1, 0);
  dfs(1, 1);
  if (vil[1] == 1) {
    swap(vil[1], vil[g[1][0]]);
    sum += 2;
  }
  cout << sum << '\n';
  for (int i = 0; i < n; ++i) ivil[vil[i + 1]] = i + 1;
  for (int i = 0; i < n; ++i) cout << ivil[i + 1] << ' ';
  cout << '\n';
}
