#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 100;
vector<int> adj[MAXN];
bool fait[MAXN];
int reponse[MAXN];
int s;
void recursion(int noeud, int pere) {
  for (auto voisin : adj[noeud]) {
    if (voisin != pere) {
      recursion(voisin, noeud);
    }
  }
  vector<int> pas;
  for (auto voisin : adj[noeud]) {
    if (voisin != pere && !fait[voisin]) {
      pas.push_back(voisin);
      fait[voisin] = true;
    }
  }
  if (pas.size() == 0) return;
  fait[noeud] = true;
  reponse[noeud] = pas[0];
  s += pas.size();
  for (int i = 0; i < pas.size() - 1; i++) {
    reponse[pas[i]] = pas[i + 1];
  }
  reponse[pas[pas.size() - 1]] = noeud;
}
int main() {
  int nbNoeuds;
  cin >> nbNoeuds;
  for (int i = 0; i < nbNoeuds - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  fill(fait, fait + nbNoeuds, false);
  s = 0;
  recursion(0, 0);
  if (!fait[0]) {
    reponse[0] = reponse[adj[0][0]];
    reponse[adj[0][0]] = 0;
    s++;
  }
  cout << s * 2 << endl;
  for (int i = 0; i < nbNoeuds; i++) {
    cout << reponse[i] + 1 << " ";
  }
  cout << endl;
}
