#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct city {
  city *before = nullptr, *after = nullptr;
  ll id;
};
unordered_map<ll, city> cities;
unordered_map<ll, vector<ll>> rule_map;
int main() {
  ll n;
  cin >> n;
  for (ll i = 0; i < n; i++) {
    pair<ll, ll> rule;
    cin >> rule.first >> rule.second;
    rule_map[rule.first].push_back(rule.second);
    rule_map[rule.second].push_back(rule.first);
    if (n == 1) {
      cout << rule.first << " " << rule.second << endl;
      return 0;
    }
  }
  auto ptr = rule_map.begin();
  while (ptr->second.size() < 2) ptr++;
  city *current = &cities[ptr->first];
  current->before = &cities[ptr->second.front()];
  current->before->id = ptr->second.front();
  current->id = ptr->first;
  for (ll i : {1, -1}) {
    city *ptr = current;
    while (rule_map[ptr->id].size() > 1) {
      city *&next = i == 1 ? ptr->after : ptr->before;
      city *&prev = i == 1 ? ptr->before : ptr->after;
      ll nextID = -1;
      if (prev->id == rule_map[ptr->id].front())
        nextID = rule_map[ptr->id].back();
      else
        nextID = rule_map[ptr->id].front();
      next = &cities[nextID];
      next->id = nextID;
      if (i == 1)
        next->before = ptr;
      else
        next->after = ptr;
      ptr = next;
    }
  }
  city *start = &cities.begin()->second;
  while (start->before) start = start->before;
  while (start) {
    cout << start->id << " ";
    start = start->after;
  }
  cout << endl;
}
