#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2e5 + 10;
const int Inf = 0x7f7f7f7f;
const long long Inf_ll = 1ll * Inf * Inf;
const int Mod = 1e9 + 7;
const double eps = 1e-7;
vector<int> G[Maxn];
int n, In[Maxn], pre[Maxn], nxt[Maxn];
void add(int u, int v) {
  In[u]++, In[v]++;
  G[u].push_back(v), G[v].push_back(u);
}
void dfs(int u, int las) {
  printf("%d ", u);
  for (auto v : G[u]) {
    if (v == las) continue;
    dfs(v, u);
  }
}
int fa[Maxn], k;
int find(int x) { return x == fa[x] ? fa[x] : fa[x] = find(fa[x]); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) pre[i] = nxt[i] = fa[i] = i;
  for (int i = 1, x, y; i < n; i++) {
    scanf("%d %d", &x, &y);
    x = find(x), y = find(y);
    add(nxt[x], pre[y]);
    nxt[x] = nxt[y], fa[y] = x;
  }
  for (int i = 1; i <= n; i++)
    if (In[i] == 1) {
      k = i;
      break;
    }
  dfs(k, 0);
  return 0;
}
