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