#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> adj[100005];
int ans[100005], res = 0;
void dfs(int nw, int bf) {
  for (int nx : adj[nw])
    if (nx != bf) {
      dfs(nx, nw);
      if (ans[nw] == 0 && ans[nx] == 0) {
        ans[nw] = nx;
        ans[nx] = nw;
        res++;
      } else if (ans[nx] == 0) {
        ans[nx] = ans[nw];
        ans[nw] = nx;
        res++;
      }
    }
  if (ans[nw] == 0 && bf == 0) {
    ans[nw] = ans[adj[nw][0]];
    ans[adj[nw][0]] = nw;
    res++;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int u, v, i = 1; i < n; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0);
  cout << res * 2 << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
}
