#include <bits/stdc++.h>
using namespace std;
void islam() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
}
map<long long, vector<long long> > v;
map<long long, long long> mp, vis;
void bc(long long i) {
  cout << i << " ";
  vis[i] = 1;
  for (vector<long long>::iterator it = v[i].begin(); it != v[i].end(); it++) {
    if (!vis[*it]) bc(*it);
  }
}
int main() {
  islam();
  long long n;
  cin >> n;
  while (n--) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
    mp[x]++, mp[y]++;
  }
  long long ans;
  for (map<long long, long long>::iterator it = mp.begin(); it != mp.end();
       it++)
    if (it->second == 1) ans = it->first;
  bc(ans);
  return 0;
}
