#include <bits/stdc++.h>
using namespace std;
map<int, vector<int> > m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    m[x].push_back(y);
    m[y].push_back(x);
  }
  for (auto i : m)
    if (i.second.size() == 1) a = i.first;
  cout << a;
  int p = -1;
  for (int i = 0; i < n; i++) {
    if (m[a][0] != p)
      a = m[p = a][0];
    else
      a = m[p = a][1];
    cout << ' ' << a;
  }
  return 0;
}
