#include <bits/stdc++.h>
using namespace std;
map<int, list<int> > f;
vector<int> dis_f;
map<int, bool> use;
void dfs(int u) {
  int v;
  list<int>& l = f[u];
  while (!l.empty()) {
    v = *(l.begin());
    l.pop_front();
    if (!use[v]) dfs(v);
  }
  dis_f.push_back(u);
}
map<int, int> g;
int n;
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int start = 0;
    for (int i = 0; i < n; ++i) {
      int u, v;
      scanf("%d%d", &u, &v);
      f[u].push_back(v);
      f[v].push_back(u);
      g[u]++, g[v]++;
    }
    map<int, int>::iterator it;
    for (it = g.begin(); it != g.end(); ++it) {
      if ((it->second % 2)) {
        start = it->first;
        break;
      }
    }
    dfs(start);
    for (int i = 0; i < n; ++i) printf("%d ", dis_f[i]);
    printf("%d\n", dis_f[n]);
  }
  return 0;
}
