#include <bits/stdc++.h>
using namespace std;
int n;
int bg, pre;
map<int, int> m;
map<int, int> m1;
map<int, int> m2;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int s, t;
    cin >> s >> t;
    m[s]++;
    m[t]++;
    if (m1.find(s) == m1.end()) {
      m1[s] = t;
    } else {
      m2[s] = t;
    }
    if (m1.find(t) == m1.end()) {
      m1[t] = s;
    } else {
      m2[t] = s;
    }
  }
  for (map<int, int>::iterator it = m.begin(); it != m.end(); it++) {
    if (it->second == 1) {
      bg = it->first;
    }
  }
  cout << bg << ' ';
  pre = bg;
  if (m1.find(bg) != m1.end()) {
    bg = m1[bg];
  } else {
    bg = m2[bg];
  }
  for (int i = 1; i <= n; i++) {
    cout << bg << ' ';
    if (m1[bg] != pre) {
      pre = bg;
      bg = m1[bg];
    } else {
      pre = bg;
      bg = m2[bg];
    }
  }
  cout << "\n";
  return 0;
}
