#include <bits/stdc++.h>
using namespace std;
map<int, int> go[2];
inline void add(int f, int t) {
  for (int i = 0; i < 2; i++)
    if (go[i].find(f) == go[i].end()) {
      go[i][f] = t;
      break;
    }
}
inline int find(int f) {
  for (int i = 0; i < 2; i++) {
    if (go[i].find(f) != go[i].end()) {
      int to = go[i][f];
      if (go[0].find(to) != go[0].end() and go[0][to] == f) {
        go[0].erase(to);
      } else
        go[1].erase(to);
      go[i].erase(f);
      return to;
    }
  }
  exit(0);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int from, to;
    scanf("%d %d", &from, &to);
    add(from, to);
    add(to, from);
  }
  int start = 0;
  for (pair<int, int> st : go[0])
    if (go[1].find(st.first) == go[1].end()) {
      start = st.first;
      break;
    }
  while (true) {
    printf("%d ", start);
    start = find(start);
  }
  return 0;
}
