#include <bits/stdc++.h>
using namespace std;
int n;
map<int, int> cnt;
map<int, vector<int> > E;
set<int> S;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    cnt[x]++;
    cnt[y]++;
    E[x].push_back(y);
    E[y].push_back(x);
  }
  int pos;
  for (map<int, int>::iterator e = cnt.begin(); e != cnt.end(); ++e)
    if (e->second == 1) {
      pos = e->first;
      break;
    }
  for (int i = 0; i <= n; ++i) {
    S.insert(pos);
    printf("%d%c", pos, i < n ? ' ' : '\n');
    for (vector<int>::iterator e = E[pos].begin(); e != E[pos].end(); ++e)
      if (!S.count(*e)) {
        pos = *e;
        break;
      }
  }
}
