#include <bits/stdc++.h>
using namespace std;
unordered_map<int, vector<int> > g;
unordered_map<int, vector<int> >::iterator it;
unordered_map<int, int> vis;
vector<int> ans;
void dfs(int x) {
  ans.push_back(x);
  vis[x] = 1;
  for (int i = 0; i < g[x].size(); i++) {
    if (vis.find(g[x][i]) == vis.end()) {
      dfs(g[x][i]);
    }
  }
}
int main() {
  int n, x, y;
  cin >> n;
  while (n-- > 0) {
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (it = g.begin(); it != g.end(); it++) {
    if (it->second.size() == 1) {
      dfs(it->first);
    }
  }
  for (int i = 0; i < ans.size() - 1; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
