#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
vector<long long int> v1;
vector<long long int> v2;
const long long int inf = 100000000000005;
map<long long int, vector<long long int> > path;
map<long long int, long long int> co, vis;
map<long long int, long long int>::iterator it;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  long long int a, b, st = -1, en = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    path[a].push_back(b);
    path[b].push_back(a);
    if (co.count(a) == 0)
      co[a] = 1;
    else
      co[a]++;
    if (co.count(b) == 0)
      co[b] = 1;
    else
      co[b]++;
  }
  for (it = co.begin(); it != co.end(); ++it) {
    if (it->second == 1 && st == -1)
      st = it->first;
    else if (it->second == 1)
      en = it->first;
  }
  while (st != en) {
    cout << st << " ";
    vis[st] = 1;
    for (int i = 0; i < path[st].size(); i++)
      if (vis.count(path[st][i]) == 0) {
        st = path[st][i];
        break;
      }
  }
  if (en != -1) cout << en << endl;
  return 0;
}
