#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 10;
int n, par[MAX_N], l[MAX_N];
vector<int> adj[MAX_N];
bool mark[MAX_N];
void edge(int u, int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
void dfs_out(int u) {
  mark[u] = 1;
  cout << u + 1 << " ";
  for (int v : adj[u])
    if (mark[v] == 0) {
      dfs_out(v);
    }
}
int parent(int v) {
  if (par[v] < 0) return v;
  return parent(par[v]);
}
void join(int u, int v) {
  u = parent(u), v = parent(v);
  if (par[u] < par[v]) swap(u, v);
  par[v] += par[u], par[u] = v;
  edge(u, l[v]);
  l[v] = l[u];
}
void get_data() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    l[i] = i;
    par[i] = -1;
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    join(u, v);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  get_data();
  dfs_out(parent(0));
  return 0;
}
