#include <bits/stdc++.h>
using namespace std;
map<long long int, vector<long long int> > g;
map<long long int, long long int> vis;
long long int count1 = 0, n;
vector<long long int> ans;
bool dfs(long long int src) {
  ans.push_back(src);
  count1++;
  vis[src] = 1;
  if (count1 == n + 1) {
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i] << " ";
    }
    return true;
  }
  for (int i = 0; i < g[src].size(); i++) {
    int v = g[src][i];
    if (vis[v] == 0) {
      if (dfs(v))
        return true;
      else
        return false;
    }
  }
  return false;
}
int main() {
  cin >> n;
  int t = n;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  long long int temp_src;
  for (auto i : g) {
    long long int src = i.first;
    if (i.second.size() == 1) temp_src = i.first;
  }
  bool final = dfs(temp_src);
  return 0;
}
