#include <bits/stdc++.h>
using namespace std;
long long n, x, y;
map<long long, long long> mp;
map<long long, vector<long long>> node;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (mp.find(x) != mp.end())
      mp[x]++;
    else
      mp[x] = 1;
    if (mp.find(y) != mp.end())
      mp[y]++;
    else
      mp[y] = 1;
    node[x].push_back(y);
    node[y].push_back(x);
  }
  long long s = -1, e = -1;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    if (it->second == 1) {
      if (s == -1)
        s = it->first;
      else
        e = it->first;
    }
  }
  cout << s << " " << node[s][0] << " ";
  long long last = s, curr = node[s][0];
  node[e].push_back(-1);
  for (int i = 0; i < n - 1; i++) {
    if (node[curr][0] == last) {
      last = curr;
      curr = node[curr][1];
    } else {
      last = curr;
      curr = node[curr][0];
    }
    cout << curr << " ";
  }
  return 0;
}
