#include <bits/stdc++.h>
using namespace std;
int main() {
  unordered_map<long long int, vector<long long int>> tree;
  long long int n, e, u, start;
  set<long long int> vis;
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> e >> u;
    tree[e].push_back(u);
    tree[u].push_back(e);
  }
  for (auto const &i : tree) {
    if ((i.second).size() == 1) {
      start = i.first;
      break;
    }
  }
  vector<long long int> res;
  vis.insert(start);
  res.push_back(start);
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < tree[res[i]].size(); j++) {
      if (!vis.count(tree[res[i]][j])) {
        vis.insert(tree[res[i]][j]);
        res.push_back(tree[res[i]][j]);
        break;
      }
    }
  }
  for (long long int i = 0; i < n + 1; i++) cout << res[i] << " ";
  return 0;
}
