#include <bits/stdc++.h>
using namespace std;
vector<int> ans;
map<int, vector<int> > mapka;
void go(int v, int p = -1) {
  ans.push_back(v);
  vector<int>& vv = mapka[v];
  if (mapka[v].size() == 1 && p != -1) return;
  int to = vv[0] == p ? vv[1] : vv[0];
  go(to, v);
}
int main() {
  ios_base::sync_with_stdio(0);
  srand(time(0));
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    mapka[a].push_back(b);
    mapka[b].push_back(a);
  }
  int s = 0;
  for (map<int, vector<int> >::iterator it = mapka.begin(); it != mapka.end();
       ++it)
    if (it->second.size() == 1) s = it->first;
  if (true)
    ;
  go(s);
  for (int i = 0; i < ans.size(); ++i) cout << ans[i] << " ";
  return 0;
}
