#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 10;
int n, cnt;
map<int, vector<int> > mp;
map<int, bool> mrk;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int u, v;
    cin >> v >> u;
    mp[u].push_back(v);
    mp[v].push_back(u);
  }
  int beg = 0;
  for (map<int, vector<int> >::iterator it = mp.begin(); it != mp.end(); it++)
    if (((*it).second).size() == 1 && beg == 0) beg = ((*it).first);
  while (cnt != n + 1) {
    cout << beg << ' ';
    mrk[beg] = 1;
    if (!mrk[mp[beg][0]])
      beg = mp[beg][0];
    else if (mp[beg].size() == 2)
      beg = mp[beg][1];
    else
      break;
  }
  return 0;
}
