#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 3;
const int maxm = 1e7 + 3;
const int mod = 1e9 + 7;
const int oo = 1e9 + 5;
const long double pi = 3.141592653589793238462643383279502884;
void input() {
  if (fopen("abc"
            ".inp",
            "r")) {
    freopen(
        "abc"
        ".inp",
        "r", stdin);
    freopen(
        "abc"
        ".out",
        "w", stdout);
  }
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int n;
int root[maxn];
vector<int> s[maxn];
int get_root(int i) { return root[i] == i ? i : root[i] = get_root(root[i]); }
int main() {
  input();
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    s[i].push_back(i);
    root[i] = i;
  }
  for (int i = 1, u, v; i < n; ++i) {
    cin >> u >> v;
    u = get_root(u);
    v = get_root(v);
    if (s[u].size() < s[v].size()) swap(s[u], s[v]);
    while (!s[v].empty()) {
      s[u].push_back(s[v].back());
      s[v].pop_back();
    }
    root[v] = u;
  }
  for (int i = 1; i <= n; ++i)
    if (s[i].size() == n)
      for (int x : s[i]) cout << x << " ";
  return 0;
}
