#include <bits/stdc++.h>
int n, nb[150005][2], fa[150005], link[150005][2], ans[150005];
int findf(int p) { return fa[p] == p ? p : fa[p] = findf(fa[p]); }
int main() {
  scanf("%d", &n);
  int i, p, q, l, r;
  for (i = 1; i <= n; i++) {
    fa[i] = i;
    link[i][0] = link[i][1] = i;
  }
  for (i = 1; i < n; i++) {
    scanf("%d%d", &p, &q);
    p = findf(p), q = findf(q);
    fa[q] = p;
    nb[link[p][1]][1] = link[q][0];
    nb[link[q][0]][0] = link[p][1];
    link[p][1] = link[q][1];
    l = link[p][0], r = link[p][1];
  }
  for (i = 1, p = l; nb[p][1]; p = nb[p][1], i++) ans[i] = p;
  ans[i] = r;
  for (i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
