#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e9 + 5;
map<int, vector<int>> g;
map<int, bool> vis;
vector<int> ans;
void dfs(int v) {
  if (vis[v]) return;
  vis[v] = true;
  ans.push_back(v);
  for (auto u : g[v]) dfs(u);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  while (n--) {
    int A, B;
    cin >> A >> B;
    g[A].push_back(B);
    g[B].push_back(A);
    vis[A] = vis[B] = false;
  }
  for (auto p : g) {
    if ((int)(p.second).size() == 1) {
      dfs(p.first);
      break;
    }
  }
  for (auto v : ans) cout << v << " ";
  cout << "\n";
}
