#include <bits/stdc++.h>
using namespace std;
map<long long, long long> cnt;
map<long long, pair<long long, long long> > mp;
pair<long long, long long> p[100001];
int main() {
  int n, a, b;
  cin >> n;
  int st;
  vector<int> val;
  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
    int a = p[i].first;
    int b = p[i].second;
    cnt[p[i].first]++;
    cnt[p[i].second]++;
    if (mp[a].first)
      mp[a].second = b;
    else
      mp[a].first = b;
    if (mp[b].first)
      mp[b].second = a;
    else
      mp[b].first = a;
  }
  for (int i = 0; i < n; i++) {
    int a = p[i].first;
    int b = p[i].second;
    if (cnt[a] == 1) {
      st = a;
      break;
    }
    if (cnt[b] == 1) {
      st = b;
      break;
    }
  }
  cout << st;
  int prev;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      prev = st;
      st = mp[st].first;
      cout << " " << st;
    } else if (prev == mp[st].first) {
      prev = st;
      st = mp[st].second;
      cout << " " << st;
    } else if (prev == mp[st].second) {
      prev = st;
      st = mp[st].first;
      cout << " " << st;
    }
  }
}
