#include <bits/stdc++.h>
using namespace std;
map<int, vector<int>> mp;
map<int, vector<int>>::iterator it;
void dfs(int rt, int sz) {
  cout << rt << ' ';
  for (int i = 0; i < mp[rt].size(); i++)
    if (mp[rt][i] != sz) dfs(mp[rt][i], rt);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, u, v;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> u >> v, mp[u].push_back(v), mp[v].push_back(u);
  for (it = mp.begin(); it != mp.end(); it++)
    if ((it->second).size() == 1) {
      dfs(it->first, 0);
      break;
    }
  return 0;
}
