#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 0x3f3f3f3f;
const int maxn = 150005;
int fa[maxn], n;
vector<int> a[maxn];
int Find(int x) { return fa[x] = (fa[x] == x) ? x : Find(fa[x]); }
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    fa[i] = i;
    a[i].push_back(i);
  }
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    x = Find(x);
    y = Find(y);
    if ((int)a[x].size() < (int)a[y].size()) swap(x, y);
    for (auto z : a[y]) a[x].push_back(z);
    fa[y] = x;
  }
  int p = Find(1);
  for (auto x : a[p]) cout << x << " ";
  return 0;
}
