#include <bits/stdc++.h>
using namespace std;
void bfs(int i, map<int, vector<int>> &chain) {
  int last = 0;
  bool cont;
  do {
    printf("%d ", i);
    cont = false;
    for (auto ele : chain[i])
      if (ele != last) {
        last = i;
        i = ele;
        cont = true;
        break;
      }
  } while (cont);
  puts("");
}
int main() {
  int n;
  int from, to;
  map<int, vector<int>> chain;
  cin >> n;
  while (n--) {
    cin >> from >> to;
    chain[from].push_back(to);
    chain[to].push_back(from);
  }
  for (auto iter : chain)
    if (iter.second.size() == 1) {
      bfs(iter.first, chain);
      break;
    }
}
