#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 2;
int a[N], b[N];
map<int, int> frq;
map<int, bool> vis;
map<int, vector<int>> mp;
vector<pair<int, int>> v;
void dfs(int node) {
  vis[node] = true;
  cout << node << " ";
  for (auto x : mp[node])
    if (!vis[x]) dfs(x);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) {
    cin >> a[i] >> b[i];
    frq[a[i]]++;
    frq[b[i]]++;
    mp[a[i]].push_back(b[i]);
    mp[b[i]].push_back(a[i]);
  }
  for (auto x : frq) v.push_back({x.second, x.first});
  sort((v).begin(), (v).end());
  int s = v[0].second;
  dfs(s);
}
