#include <bits/stdc++.h>
using namespace std;
int n;
set<int> se;
map<int, int> ma;
int rev[200005], mac = 0;
vector<int> g[200005];
int from[100000], to[100000];
int cnt[200005] = {};
vector<int> ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> from[i] >> to[i];
    se.insert(from[i]);
    se.insert(to[i]);
  }
  for (int x : se) rev[mac] = x, ma[x] = mac++;
  for (int i = 0; i < n; i++) {
    from[i] = ma[from[i]], to[i] = ma[to[i]];
  }
  for (int i = 0; i < n; i++) {
    ++cnt[from[i]], ++cnt[to[i]];
  }
  for (int i = 0; i < n; i++) g[from[i]].push_back(to[i]);
  for (int i = 0; i < n; i++) g[to[i]].push_back(from[i]);
  int v = 0;
  while (cnt[v] != 1) v++;
  ans.push_back(rev[v]);
  int pre = -1;
  bool flag = true;
  while (flag) {
    flag = false;
    for (int to : g[v])
      if (to != pre) {
        flag = true;
        pre = v;
        v = to;
        ans.push_back(rev[v]);
        break;
      }
  }
  for (int x : ans) cout << x << ' ';
  cout << endl;
  return 0;
}
