#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
template <typename T, typename... Args>
void read(T &first, Args &...args) {
  read(first);
  read(args...);
}
template <typename T>
void write(T arg) {
  T x = arg;
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
template <typename T, typename... Ts>
void write(T arg, Ts... args) {
  write(arg);
  if (sizeof...(args) != 0) {
    putchar(' ');
    write(args...);
  }
}
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const int N = 150005;
int T, n, tot = 0;
int mark[N], ans[N];
vector<int> edge[N];
void dfs(int u, int fa) {
  for (auto v : edge[u]) {
    if (v != fa) {
      dfs(v, u);
      if (!mark[v]) {
        tot += 2;
        mark[v] = mark[u] = 1;
        swap(ans[u], ans[v]);
      }
    }
  }
}
int main(void) {
  cin >> n;
  for (int i = 1; i <= n; i++) ans[i] = i;
  int u, v;
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  dfs(1, 1);
  if (ans[1] == 1) {
    tot += 2;
    swap(ans[1], ans[edge[1][0]]);
  }
  cout << tot << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << endl;
}
