#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n;
  cin >> n;
  map<int, int> mm;
  map<int, vector<int>> m;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    mm[x]++;
    mm[y]++;
    m[x].push_back(y);
    m[y].push_back(x);
  }
  int s = -1;
  for (auto t : mm) {
    if (t.second == 1) {
      s = t.first;
    }
  }
  int now = s;
  map<int, bool> used;
  while (true) {
    cout << now << ' ';
    used[now] = true;
    bool ok = true;
    for (auto x : m[now]) {
      if (used[x]) continue;
      now = x;
      ok = false;
    }
    if (ok) break;
  }
  return 0;
}
