#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << a;
  cout << '\n';
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << ' ';
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << ' ';
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << ' ';
  pr(b, c, d);
}
template <class A>
void PR(A a, long long n) {
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    if (i) cout << ' ';
    cout << a[i];
  }
  cout << '\n';
}
long long check(long long n, long long m, long long x, long long y) {
  return x >= 0 && x < n && y >= 0 && y < m;
}
const long long MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
                dy[4] = {0, 1, 0, -1};
int p[200001], r[200001];
vector<int> v[200001];
void init() {
  for (long long i = (long long)(0); i < (long long)(200001); i++)
    p[i] = i, r[i] = 0, v[i].push_back(i);
}
int find(int x) { return (p[x] == x) ? x : (p[x] = find(p[x])); }
void unite(int x, int y) {
  x = find(x), y = find(y);
  if (x == y) return;
  if (r[x] < r[y])
    p[x] = y;
  else {
    p[y] = x;
    if (r[x] == r[y]) r[x]++;
  }
  int z = find(x);
  if (v[x].size() < v[y].size()) {
    for (long long i = (long long)(0); i < (long long)(v[x].size()); i++)
      v[y].push_back(v[x][i]);
    if (z == x) {
      swap(v[x], v[y]);
      v[y].clear();
    } else
      v[x].clear();
  } else {
    for (long long i = (long long)(0); i < (long long)(v[y].size()); i++)
      v[x].push_back(v[y][i]);
    if (z == y) {
      swap(v[x], v[y]);
      v[x].clear();
    } else
      v[y].clear();
  }
}
bool same(int x, int y) { return find(x) == find(y); }
void Main() {
  init();
  long long n;
  cin >> n;
  for (long long i = (long long)(0); i < (long long)(n - 1); i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    unite(x, y);
  }
  int x = find(0);
  for (long long i = (long long)(0); i < (long long)(v[x].size()); i++)
    v[x][i]++;
  PR(v[x], v[x].size());
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  Main();
  return 0;
}
