#include <bits/stdc++.h>
using namespace std;
map<long long, vector<long long> > G;
map<long long, bool> visited;
void dfs(long long u) {
  long long i;
  visited[u] = true;
  cout << u << " ";
  for (i = 0; i < G[u].size(); i++) {
    if (visited.find(G[u][i]) == visited.end()) {
      dfs(G[u][i]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n, u, v, i, s;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  map<long long, vector<long long> >::iterator it;
  for (it = G.begin(); it != G.end(); it++) {
    if (it->second.size() == 1) {
      s = it->first;
      break;
    }
  }
  dfs(s);
  cout << "\n";
  return 0;
}
