#include <bits/stdc++.h>
using namespace std;
const long long int logx = 30;
const long long int N = 2e5 + 5;
const long long int INF = 1e18;
const long long int mod = 1e9 + 21;
const double PI = 3.14159265358979323846;
template <typename T>
T power(T x, T y, long long int m) {
  T ans = 1;
  while (y > 0) {
    if (y & 1LL) ans = (ans * x) % m;
    y >>= 1ll;
    x = (x * x) % m;
  }
  return ans % m;
}
vector<long long int> g[N];
long long int n, m, u, v, a[N], siz[N];
vector<long long int> vec[N];
long long int root(long long int x) {
  while (x != a[x]) {
    a[x] = a[a[x]];
    x = a[x];
  }
  return x;
}
void unionx(long long int x, long long int y) {
  long long int rx = root(x);
  long long int ry = root(y);
  if (rx == ry) {
    return;
  } else {
    if (siz[rx] < siz[ry]) {
      a[rx] = ry;
      siz[ry] += siz[rx];
      for (auto j : vec[rx]) {
        vec[ry].push_back(j);
      }
      vec[rx].clear();
      siz[rx] = 0;
    } else {
      a[ry] = rx;
      siz[rx] += siz[ry];
      for (auto j : vec[ry]) {
        vec[rx].push_back(j);
      }
      vec[ry].clear();
      siz[ry] = 0;
    }
  }
}
int main() {
  cin >> n;
  m = n - 1;
  for (long long int i = 1; i <= n; i++) {
    a[i] = i;
    siz[i] = 1;
    vec[i].push_back(i);
  }
  while (m--) {
    cin >> u >> v;
    long long int x = root(u);
    long long int y = root(v);
    if (x == y) {
      continue;
    }
    unionx(u, v);
  }
  long long int rx = root(1);
  for (auto j : vec[rx]) {
    cout << j << " ";
  }
}
