#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
long long power(long long b, long long e, long long m) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b % m, e / 2, m) % m;
  return power(b * b % m, e / 2, m);
}
long long power(long long b, long long e) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b, e / 2);
  return power(b * b, e / 2);
}
template <typename T, typename U>
static inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static inline void amax(T &x, U y) {
  if (x < y) x = y;
}
const int N = 1500005;
long long p[N][2], r[N], par[N];
vector<long long> v[N];
long long parent(long long i) {
  if (i == par[i]) return i;
  return par[i] = parent(par[i]);
}
void merge(long long x, long long y) {
  x = parent(x), y = parent(y);
  if (r[x] > r[y]) {
    par[y] = x;
    v[p[y][1]].push_back(p[x][1]);
    v[p[x][1]].push_back(p[y][1]);
    p[x][1] = p[y][0];
  } else {
    v[p[y][1]].push_back(p[x][1]);
    v[p[x][1]].push_back(p[y][1]);
    par[x] = y;
    if (r[x] == r[y]) ++r[y];
    p[y][1] = p[x][0];
  }
}
void dfs(long long s, long long p = -1) {
  cout << s << " ";
  for (auto j : v[s])
    if (j != p) dfs(j, s);
}
int _runtimeTerror_() {
  long long n;
  cin >> n;
  long long i;
  for (i = 1; i <= n; ++i) r[i] = 0, p[i][0] = p[i][1] = i, par[i] = i;
  for (i = 0; i < n - 1; ++i) {
    long long x, y;
    cin >> x >> y;
    merge(x, y);
  }
  long long root = -1;
  for (i = 1; i <= n; ++i)
    if ((long long)v[i].size() == 1) break;
  root = i;
  dfs(root);
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) _runtimeTerror_();
  cerr << "\n" << 1.0 * clock() / CLOCKS_PER_SEC;
  return 0;
}
