#include <bits/stdc++.h>
using namespace std;
map<int, map<int, int> > Gady;
map<int, int> visit;
void DFS(int u) {
  if (visit[u]) return;
  visit[u] = 1;
  cout << " " << u;
  map<int, int>::iterator itm;
  for (itm = Gady[u].begin(); itm != Gady[u].end(); itm++) DFS(itm->first);
}
int main() {
  for (int n, u, v; cin >> n;) {
    Gady.clear();
    visit.clear();
    for (int i = 0; i < n; i++) {
      cin >> u >> v;
      Gady[u][v] = 1;
      Gady[v][u] = 1;
    }
    map<int, map<int, int> >::iterator it;
    int idx;
    for (it = Gady.begin(); it != Gady.end(); it++) {
      if (it->second.size() == 1) idx = it->first;
    }
    cout << idx;
    visit[idx] = 1;
    map<int, int>::iterator itm = Gady[idx].begin();
    DFS(itm->first);
    cout << endl;
  }
}
