#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <class T>
inline bool MX(T &l, const T &r) {
  return l < r ? l = r, 1 : 0;
}
template <class T>
inline bool MN(T &l, const T &r) {
  return l > r ? l = r, 1 : 0;
}
int N;
int belong[154514];
vector<int> vs[154514];
signed main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(0);
  cin >> N;
  for (int(i) = 0; (i) < (N); ++(i)) {
    belong[i] = i;
    vs[i].emplace_back(i);
  }
  for (int(i) = 0; (i) < (N - 1); ++(i)) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    x = belong[x];
    y = belong[y];
    assert(x != y);
    if (vs[x].size() > vs[y].size()) swap(x, y);
    for (int c : vs[x]) {
      belong[c] = y;
    }
    vs[y].insert(vs[y].end(), (vs[x]).begin(), (vs[x]).end());
  }
  for (int(i) = 0; (i) < (N); ++(i)) {
    if (i) cout << " ";
    cout << vs[belong[0]][i] + 1;
  }
  cout << endl;
}
