#include <bits/stdc++.h>
using namespace std;
map<int, vector<int> > adj;
map<int, bool> visited;
void DFS(int u) {
  visited[u] = 1;
  for (auto v : adj[u])
    if (!visited[v]) DFS(v);
  cout << u << " ";
}
int main() {
  int ACCEPTED = 1;
  ;
  while (ACCEPTED--) {
    int n, a, b;
    cin >> n;
    for (int i = 0; i < n; ++i)
      cin >> a >> b, adj[a].push_back(b), adj[b].push_back(a);
    for (auto x : adj)
      if ((x.second).size() == 1) {
        DFS(x.first);
        break;
      }
  }
  return 0;
}
