#include <bits/stdc++.h>
using namespace std;
struct intPair {
  int *a;
  int *b;
};
int main() {
  map<int, set<int> > values;
  int nLines;
  cin >> nLines;
  for (int i = 0; i < nLines; i++) {
    int a;
    int b;
    cin >> a;
    cin >> b;
    values[a].insert(b);
    values[b].insert(a);
  }
  map<int, set<int> >::iterator g;
  map<int, set<int> >::iterator c;
  for (c = values.begin(); c != values.end(); c++) {
    if (c->second.size() == 1) {
      break;
    }
  }
  int prev = c->first;
  int next = *c->second.begin();
  printf("%d %d ", prev, next);
  set<int> j = values[next];
  while (j.size() == 2) {
    int k = *j.begin();
    if (k == prev) {
      set<int>::iterator n = j.begin();
      n++;
      k = *n;
    }
    prev = next;
    next = k;
    j = values[next];
    printf("%d ", next);
  }
}
