#include <bits/stdc++.h>
using namespace std;
long par[150009];
vector<long> v[150009];
int main() {
  long i, j, k, l, m, n, x, y, c, d;
  memset(par, -1, sizeof(par));
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> x >> y;
    if (par[x] == -1 && par[y] == -1) {
      par[x] = x;
      par[y] = x;
      v[x].push_back(x);
      v[x].push_back(y);
    } else if (par[x] == -1 && par[y] != -1) {
      par[x] = par[y];
      v[par[y]].push_back(x);
    } else if (par[x] != -1 && par[y] == -1) {
      par[y] = par[x];
      v[par[x]].push_back(y);
    } else {
      c = par[x];
      d = par[y];
      long sz1 = v[c].size();
      long sz2 = v[d].size();
      if (sz1 >= sz2) {
        for (j = 0; j < sz2; j++) {
          v[c].push_back(v[d][j]);
          par[v[d][j]] = c;
        }
        v[d].clear();
      } else if (sz1 < sz2) {
        for (j = 0; j < sz1; j++) {
          v[d].push_back(v[c][j]);
          par[v[c][j]] = d;
        }
        v[c].clear();
      }
    }
  }
  int mx = 0, idx = 0;
  for (i = 1; i <= n; i++) {
    if (v[i].size() > mx) {
      mx = v[i].size();
      idx = i;
    }
  }
  for (i = 0; i < v[idx].size(); i++) {
    cout << v[idx][i] << " ";
  }
  cout << endl;
  return 0;
}
