#include <bits/stdc++.h>
using namespace std;
unordered_map<long int, long int> mp;
int vis[200002];
long int val[200002];
vector<long int> vect[200002];
void dfs(long int x) {
  cout << x << " ";
  vis[mp[x]] = 1;
  long int sz = vect[mp[x]].size();
  for (long int i = 0; i < sz; ++i) {
    long int ind = mp[vect[mp[x]][i]];
    if (vis[ind] == 0) dfs(val[ind]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long int n;
  cin >> n;
  long int x, y;
  long int temp = 0;
  for (long int i = 1; i <= n; ++i) {
    cin >> x >> y;
    if (mp.find(x) != mp.end())
      ;
    else {
      mp[x] = ++temp;
      val[temp] = x;
    }
    if (mp.find(y) != mp.end())
      ;
    else {
      mp[y] = ++temp;
      val[temp] = y;
    }
    vect[mp[x]].push_back(y);
    vect[mp[y]].push_back(x);
  }
  long int i;
  for (i = 1; i <= temp; ++i) {
    if (vect[i].size() == 1) break;
  }
  dfs(val[i]);
  return 0;
}
