#include <bits/stdc++.h>
using namespace std;
long long n, m;
map<long long, vector<long long> > mp;
map<long long, long long> cnt;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  long long a, b;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    cnt[a]++;
    cnt[b]++;
    if (mp.find(a) != mp.end()) {
      mp[a].push_back(b);
    } else {
      vector<long long> v;
      v.push_back(b);
      mp[a] = v;
    }
    if (mp.find(b) != mp.end()) {
      mp[b].push_back(a);
    } else {
      vector<long long> v;
      v.push_back(a);
      mp[b] = v;
    }
  }
  map<long long, long long>::iterator itr = cnt.begin();
  long long start = -1;
  while (itr != cnt.end()) {
    if (itr->second == 1) {
      start = itr->first;
      break;
    }
    itr++;
  }
  vector<long long> path;
  path.push_back(start);
  long long cur = start;
  long long prev = -1;
  while (path.size() <= (n)) {
    vector<long long> ops = mp[cur];
    long long put = -1;
    for (int i = 0; i < ops.size(); i++) {
      if (ops[i] != prev) {
        path.push_back(ops[i]);
        prev = cur;
        cur = ops[i];
        break;
      }
    }
  }
  for (int i = 0; i <= n; i++) {
    cout << path[i] << " ";
  }
}
