#include <bits/stdc++.h>
using namespace std;
const int maxn = 1.5e5 + 5;
vector<int> G[maxn];
int pre[maxn];
int find(int x) { return x == pre[x] ? x : pre[x] = find(pre[x]); }
void dfs(int u) {
  cout << u << " ";
  for (int i = 0; i < G[u].size(); ++i) {
    dfs(G[u][i]);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int u, v;
  int rt;
  for (int i = 1; i <= n; ++i) pre[i] = i;
  for (int i = 0; i < n - 1; ++i) {
    scanf("%d%d", &u, &v);
    u = find(u), v = find(v);
    G[rt = u].push_back(v);
    pre[v] = u;
  }
  dfs(rt);
  return 0;
}
