#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unordered_map<int, vector<int>> m;
  unordered_map<int, int> iv;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    m[x].push_back(y);
    m[y].push_back(x);
    iv[x] = 0;
    iv[y] = 0;
  }
  vector<int> v;
  int s;
  for (auto it = m.begin(); it != m.end(); it++) {
    if (it->second.size() == 1) {
      iv[it->first] = 1;
      iv[it->second[0]] = 1;
      s = it->second[0];
      v.push_back(it->first);
      v.push_back(it->second[0]);
      break;
    }
  }
  while (m[s].size() > 1) {
    if (iv[m[s][0]] == 0) {
      iv[m[s][0]] = 1;
      v.push_back(m[s][0]);
      s = m[s][0];
    } else {
      iv[m[s][1]] = 1;
      v.push_back(m[s][1]);
      s = m[s][1];
    }
  }
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
  return 0;
}
