#include <bits/stdc++.h>
using namespace std;
struct pp {
  int f, s;
};
int main() {
  vector<int> with[200005];
  int n;
  cin >> n;
  pp a[200005];
  int i, j;
  for (i = 1; i <= n; i++) {
    cin >> a[i].f >> a[i].s;
    if (a[i].f > a[i].s) swap(a[i].f, a[i].s);
    with[a[i].f].push_back(a[i].s);
    with[a[i].s].push_back(a[i].f);
  }
  vector<int> res;
  res.push_back(a[1].f);
  res.push_back(a[1].s);
  int last = a[1].f;
  int curr = a[1].s;
  for (i = 3; i <= n; i++) {
    if (with[curr][0] != last) {
      res.push_back(with[curr][0]);
      last = curr;
      curr = with[curr][0];
    } else {
      res.push_back(with[curr][1]);
      last = curr;
      curr = with[curr][1];
    }
  }
  if ((min(res[1], res[2]) == a[res[0]].f) &&
      (max(res[1], res[2]) == a[res[0]].s)) {
    for (i = 0; i < n; i++) cout << res[i] << " ";
  } else {
    for (i = n - 1; i >= 0; i--) cout << res[i] << " ";
  }
}
