#include <bits/stdc++.h>
using namespace std;
const long long int N = 100005;
const long long int MOD = 1000000007;
long long int n;
map<long long int, vector<long long int> > m;
map<long long int, long long int> vis;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long int i = 0; i < n; ++i) {
    long long int x, y;
    cin >> x >> y;
    m[x].push_back(y);
    m[y].push_back(x);
  }
  long long int start = -1, finish = -1;
  map<long long int, vector<long long int> >::iterator it;
  for (it = m.begin(); it != m.end(); ++it) {
    if ((it->second).size() == 1) {
      if (start == -1)
        start = it->first;
      else
        finish = it->first;
    }
  }
  long long int p = start;
  while (p != finish) {
    cout << p << ' ';
    vis[p] = 1;
    for (long long int i = 0; i < m[p].size(); ++i) {
      if (vis[m[p][i]]) continue;
      p = m[p][i];
      break;
    }
  }
  cout << p << '\n';
  return 0;
}
