#include <bits/stdc++.h>
using namespace std;
int fa[150000 + 10];
int head[150000 + 10];
int _next[150000 + 10];
int find(int x) {
  if (fa[x] == x) return fa[x];
  return fa[x] = find(fa[x]);
}
void dfs(int x) {
  stack<int> sta;
  printf("%d ", x);
  for (int i = head[x]; i != -1; i = _next[i]) sta.push(i);
  while (sta.size()) dfs(sta.top()), sta.pop();
}
void add(int x, int y) {
  _next[find(x)] = head[find(y)];
  head[find(y)] = find(x);
  if (find(x) != find(y)) fa[find(x)] = find(y);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) fa[i] = i, head[i] = -1;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
  }
  dfs(find(1));
  return 0;
}
