#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 2e5;
class DSU {
  int par[N], sz[N];
  vector<int> values[N];
  int find(int u) {
    if (u == par[u]) return u;
    return find(par[u]);
  }

 public:
  DSU() {
    iota(par, par + N, 0);
    fill(sz, sz + N, 1);
    for (int u = 0; u < N; u++) {
      values[u].push_back(u + 1);
    }
  }
  bool merge(int u, int v) {
    u = find(u), v = find(v);
    if (u == v) return false;
    if (sz[u] > sz[v]) swap(u, v);
    par[u] = v;
    sz[v] += sz[u];
    sz[u] = 0;
    values[v].insert(values[v].end(), values[u].begin(), values[u].end());
    values[u] = vector<int>();
    return true;
  }
  bool same(int u, int v) { return find(u) == find(v); }
  void print(int n) {
    int u = find(0);
    for (int x : values[u]) cout << x << ' ';
    cout << endl;
  }
} dsu;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    dsu.merge(x - 1, y - 1);
  }
  dsu.print(n);
  return 0;
}
