#include <bits/stdc++.h>
using namespace std;
long long n, u, v, sz, st1, st2;
vector<pair<long long, long long> > adj[150002];
set<pair<long long, long long> > st;
bool vis[150002];
pair<long long, long long> t;
void bfs() {
  cout << st1 << " " << st2 << " ";
  vis[st1] = vis[st2] = 1;
  for (auto it : adj[st1])
    if (!vis[it.second]) st.insert(it);
  for (auto it : adj[st2])
    if (!vis[it.second]) st.insert(it);
  while (!st.empty()) {
    t = *st.begin();
    st.erase(st.begin());
    if (vis[t.second]) continue;
    cout << t.second << " ";
    vis[t.second] = 1;
    for (auto it : adj[t.second])
      if (!vis[it.second]) st.insert(it);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    cin >> u >> v;
    if (!i) {
      st1 = u;
      st2 = v;
    }
    adj[u].push_back({i, v});
    adj[v].push_back({i, u});
  }
  bfs();
  return 0;
}
