#include <bits/stdc++.h>
using namespace std;
map<int, vector<int> > g;
vector<int> x;
map<int, int> use;
void dfs(int v) {
  use[v] = 1;
  x.push_back(v);
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (!use[to]) {
      dfs(to);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  int z = 0;
  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 &h : g) {
    if (h.second.size() == 1) {
      z = h.first;
    }
  }
  dfs(z);
  for (int i = 0; i < x.size(); i++) {
    cout << x[i] << " ";
  }
}
