#include <bits/stdc++.h>
using namespace std;
int n, from, to;
map<int, list<int> > adj;
list<int> g;
map<int, bool> visited;
set<int> s;
void dfs(int u) {
  visited[u] = true;
  for (auto v : adj[u]) {
    if (!visited[v]) {
      dfs(v);
    }
  }
  g.push_back(u);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d", &from, &to);
    if (adj.find(from) == adj.end()) {
      list<int> tmp;
      adj[from] = tmp;
    }
    if (adj.find(to) == adj.end()) {
      list<int> tmp;
      adj[to] = tmp;
    }
    adj[from].push_back(to);
    adj[to].push_back(from);
    s.insert(from);
    s.insert(to);
  }
  for (auto c : s) {
    if (adj[c].size() == 1) {
      dfs(c);
      break;
    }
  }
  for (auto c : g) {
    printf("%d ", c);
  }
  putchar('\n');
  return 0;
}
