#include <bits/stdc++.h>
using namespace std;
map<int, vector<int> > m;
set<int> ss;
void dfs(int s) {
  cout << s << ' ';
  ss.insert(s);
  for (typeof((m[s]).begin()) it = (m[s]).begin(); it != (m[s]).end(); ++it)
    if (!((ss).find(*it) != (ss).end())) dfs(*it);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, src, dest, s;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> src >> dest;
    m[src].push_back(dest);
    m[dest].push_back(src);
  }
  for (typeof((m).begin()) it = (m).begin(); it != (m).end(); ++it)
    if (int((it->second).size()) == 1) {
      s = it->first;
      break;
    }
  dfs(s);
  return 0;
}
