#include <bits/stdc++.h>
using namespace std;
int ans = 0;
set<int> bag;
map<int, vector<int>> mp;
void dfs(int num, int* ptr) {
  bag.insert(num);
  for (auto m : mp[num]) {
    if (bag.find(m) == bag.end()) {
      if (mp[m].size() == 1) {
        swap(ptr[num], ptr[m]);
        ans += 2;
      } else
        dfs(m, ptr);
    }
  }
  if (ptr[num] == num) {
    for (int j = 0; j < mp[num].size(); j++) {
      if (ptr[mp[num][j]] == mp[num][j]) {
        swap(ptr[num], ptr[mp[num][j]]);
        break;
      }
    }
    if (ptr[num] == num) swap(ptr[num], ptr[mp[num][0]]);
    ans += 2;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q, u, v, sp;
  cin >> q;
  int arr[q + 1];
  for (int m = 1; m < q; m++) {
    cin >> u >> v;
    arr[u] = u;
    arr[v] = v;
    mp[u].push_back(v);
    mp[v].push_back(u);
  }
  dfs(1, arr);
  cout << ans << "\n";
  for (int l = 1; l <= q; l++) cout << arr[l] << " ";
  cout << "\n";
  return 0;
}
