#include <bits/stdc++.h>
using namespace std;
map<int, vector<int> > passage;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a, b;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    passage[a].push_back(b);
    passage[b].push_back(a);
  }
  map<int, vector<int> >::iterator it;
  for (it = passage.begin(); it != passage.end(); ++it)
    if (it->second.size() == 1) break;
  int p = it->first;
  int u = -1;
  for (int i = 0; i < n + 1; i++) {
    cout << p << ' ';
    if (passage[p].size() == 1) {
      u = p;
      p = passage[p][0];
    } else {
      if (passage[p][0] != u) {
        u = p;
        p = passage[p][0];
      } else {
        u = p;
        p = passage[p][1];
      }
    }
  }
  cout << endl;
  return 0;
}
