#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
bool blocked[MAXN];
int val[MAXN];
int ans;
vector<int> v1[MAXN];
void dfs(int curr, int par) {
  for (int x : v1[curr]) {
    if (x != par) {
      dfs(x, curr);
    }
  }
  for (int x : v1[curr]) {
    if (x != par) {
      if (!blocked[x]) {
        ans += 2;
        swap(val[curr], val[x]);
        blocked[x] = true;
        blocked[curr] = true;
      }
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    val[i] = i;
  }
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    v1[x].push_back(y);
    v1[y].push_back(x);
  }
  dfs(1, 1);
  if (!blocked[1]) {
    for (int x : v1[1]) {
      ans += 2;
      swap(val[1], val[x]);
      blocked[x] = true;
      blocked[1] = true;
      break;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    cout << val[i] << " ";
  }
  cout << endl;
}
