#include <bits/stdc++.h>
using namespace std;
const int N = 1111111, INF = 1111111111, MN = -1111111111;
int n, used[N], nach[N], kon[N], rnk[N], p[N];
vector<int> g[N];
void dfs(int v) {
  used[v] = 1;
  cout << v << ' ';
  for (auto to : g[v]) {
    if (!used[to]) dfs(to);
  }
}
int dsu_get(int x) {
  if (p[x] == x) return x;
  return p[x] = dsu_get(p[x]);
}
void dsu_unite(int a, int b) {
  a = dsu_get(a);
  b = dsu_get(b);
  if (rnk[a] < rnk[b]) {
    swap(a, b);
  }
  g[kon[a]].push_back(nach[b]);
  p[b] = a;
  rnk[a] += rnk[b];
  kon[a] = kon[b];
}
int main() {
  if (fopen(""
            ".in",
            "r"))
    freopen(
        ""
        ".in",
        "r", stdin),
        freopen(
            ""
            ".out",
            "w", stdout);
  ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    kon[i] = p[i] = nach[i] = i;
    rnk[i] = 1;
  }
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    dsu_unite(x, y);
  }
  int start = dsu_get(1);
  dfs(nach[start]);
  return 0;
}
