#include <bits/stdc++.h>
using namespace std;
map<int, int> ma, marev;
vector<vector<int> > adj;
bool vis[100010];
queue<int> q;
stringstream res;
void dfs(int x) {
  res << marev[x] << " ";
  vis[x] = true;
  for (int i = 0; i < adj[x].size(); ++i) {
    if (!vis[adj[x][i]]) dfs(adj[x][i]);
  }
}
int main() {
  int n, x, y;
  cin >> n;
  adj.resize(n + 3);
  memset(vis, 0, sizeof vis);
  int k(1);
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    if (!ma[x]) {
      ma[x] = k;
      marev[k] = x;
      ++k;
    }
    if (!ma[y]) {
      ma[y] = k;
      marev[k] = y;
      ++k;
    }
    adj[ma[x]].push_back(ma[y]);
    adj[ma[y]].push_back(ma[x]);
  }
  int it(1);
  while (adj[it].size() > 1) ++it;
  dfs(it);
  cout << res.str();
  return 0;
}
