#include <bits/stdc++.h>
const int MAXN = 100005;
const long long inf = 1e18;
bool debug = true;
using namespace std;
map<int, vector<int>> adj;
map<int, int> deg;
map<int, bool> vis;
void dfs(int r) {
  cout << r << " ";
  vis[r] = true;
  vector<int> v = adj[r];
  for (auto it : v) {
    if (vis.find(it) == vis.end()) dfs(it);
  }
}
void solve() {
  deg.clear();
  adj.clear();
  vis.clear();
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    deg[x]++;
    deg[y]++;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  int r = 0;
  for (auto it : deg) {
    if (it.second == 1) {
      r = it.first;
      break;
    }
  }
  dfs(r);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
