#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, ans = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return f * ans;
}
const int MAXN = 1e5 + 11;
int N, nex[MAXN];
vector<int> vec[MAXN];
int Ans;
void dfs(int u, int fath) {
  for (auto v : vec[u])
    if (v != fath) {
      dfs(v, u);
      if (!nex[u] && !nex[v]) nex[u] = v, nex[v] = u;
    }
  return;
}
int main() {
  N = read();
  for (int i = 1; i < N; i++) {
    int u = read(), v = read();
    vec[u].push_back(v), vec[v].push_back(u);
  }
  dfs(1, 0);
  for (int i = 1; i <= N; i++) {
    if (nex[i]) {
      Ans++;
      continue;
    }
    Ans += 2;
    int v = vec[i][0];
    nex[i] = nex[v], nex[v] = i;
  }
  printf("%d\n", Ans);
  for (int i = 1; i <= N; i++) printf("%d ", nex[i]);
  printf("\n");
  return 0;
}
