#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, u, v;
map<int, pair<int, int> > road;
map<int, pair<int, int> >::iterator it;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> u >> v;
    if (road[u].first)
      road[u].second = v;
    else
      road[u].first = v;
    if (road[v].first)
      road[v].second = u;
    else
      road[v].first = u;
  }
  for (it = road.begin(); it != road.end(); it++) {
    if (it->second.second == 0) {
      u = it->first;
      break;
    }
  }
  v = 0;
  while (1) {
    cout << u << ' ';
    if (road[u].first == v) {
      if (road[u].second == 0)
        break;
      else {
        v = u;
        u = road[u].second;
      }
    } else {
      v = u;
      u = road[u].first;
    }
  }
  return 0;
}
