#include <bits/stdc++.h>
using namespace std;
map<int, vector<int> > mp;
map<int, bool> used;
vector<int> v;
void dfs(int v) {
  used[v] = 1;
  cout << v << " ";
  for (int i = 0; i < mp[v].size(); ++i) {
    if (!used[mp[v][i]]) {
      dfs(mp[v][i]);
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int x, y;
    cin >> x >> y;
    mp[x].push_back(y);
    mp[y].push_back(x);
    v.push_back(x);
    v.push_back(y);
    used[x] = 0;
    used[y] = 0;
  }
  for (int i = 0; i < v.size(); ++i) {
    if (mp[v[i]].size() == 1) {
      dfs(v[i]);
      break;
    }
  }
  return 0;
}
