#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > adj;
vector<bool> visited;
vector<int> city;
void dfs(int u) {
  if (visited[u]) return;
  visited[u] = 1;
  cout << city[u] << " ";
  for (int i = 0; i < adj[u].size(); i++) dfs(adj[u][i]);
}
int main() {
  int n, m = 0;
  cin >> n;
  adj.resize(2 * n + 2);
  visited.resize(2 * n + 2, 0);
  int city1, city2;
  map<int, int> citimap;
  set<int> terminals;
  for (int i = 0; i < n; i++) {
    cin >> city1 >> city2;
    if (terminals.find(city1) == terminals.end())
      terminals.insert(city1);
    else
      terminals.erase(city1);
    if (terminals.find(city2) == terminals.end())
      terminals.insert(city2);
    else
      terminals.erase(city2);
    if (citimap.find(city1) == citimap.end()) {
      citimap[city1] = city.size();
      city.push_back(city1);
    }
    if (citimap.find(city2) == citimap.end()) {
      citimap[city2] = city.size();
      city.push_back(city2);
    }
    adj[citimap[city1]].push_back(citimap[city2]);
    adj[citimap[city2]].push_back(citimap[city1]);
  }
  int start = (*(terminals.begin()));
  dfs(citimap[start]);
  cout << endl;
}
