#include <bits/stdc++.h>
using namespace std;
const long long oo = 1ll << 17;
const long long mos = 0x7FFFFFFF;
const long long nmos = 0x80000000;
const int inf = 0x3f3f3f3f;
const long long inff = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e8;
const double esp = 1e-8;
const double PI = acos(-1.0);
const double PHI = 0.61803399;
const double tPHI = 0.38196601;
template <typename T>
inline T read(T &x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x = f ? -x : x;
}
inline void cmax(int &x, int y) {
  if (x < y) x = y;
}
inline void cmax(long long &x, long long y) {
  if (x < y) x = y;
}
inline void cmin(int &x, int y) {
  if (x > y) x = y;
}
inline void cmin(long long &x, long long y) {
  if (x > y) x = y;
}
const int maxn = 2e5 + 9;
struct node {
  int le = -1, ri = -1;
} t[10 * maxn];
int fa[maxn * 10];
int find(int x) {
  if (fa[x] == x)
    return x;
  else
    return fa[x] = find(fa[x]);
}
vector<int> ans;
void dfs(int u) {
  if (t[u].le == -1 && t[u].ri == -1) {
    ans.push_back(u);
    return;
  }
  if (t[u].le != -1) dfs(t[u].le);
  if (t[u].ri != -1) dfs(t[u].ri);
}
int main() {
  int n;
  scanf("%d", &n);
  int tot = n;
  for (int i = 1; i <= n * 10; i++) fa[i] = i;
  for (int i = (1); i <= (n - 1); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    tot++;
    t[tot].le = find(u);
    t[tot].ri = find(v);
    fa[find(u)] = fa[find(v)] = tot;
  }
  dfs(tot);
  for (int i = 0; i < ans.size(); i++) printf("%d ", ans[i]);
  puts("");
  return 0;
}
