#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  map<int, vector<int>> g;
  map<int, bool> Mark;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (auto &x : g) {
    if (x.second.size() == 1) {
      int node = x.first;
      while (true) {
        cout << node << ' ';
        Mark[node] = true;
        int next = -1;
        for (auto &y : g[node]) {
          if (!Mark[y]) {
            next = y;
            break;
          }
        }
        if (next == -1) break;
        node = next;
      }
      break;
    }
  }
  return 0;
}
