#include <bits/stdc++.h>
using namespace std;
long long n, x, y, lista[200000];
vector<long long> v[200000];
void pokreni(long long x, long long y) {
  long long temp = lista[y];
  for (long long i : v[lista[y]]) {
    v[lista[x]].push_back(i);
    lista[i] = lista[x];
  }
  v[temp].clear();
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= 150000; i++) {
    lista[i] = i;
    v[i].push_back(i);
  }
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    if (v[lista[x]].size() < v[lista[y]].size()) swap(x, y);
    pokreni(x, y);
  }
  for (int i = 1; i <= n; i++) {
    if (v[i].size() > 0) {
      for (auto k : v[i]) cout << k << ' ';
      break;
    }
  }
  return 0;
}
