#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v(n + 1);
  vector<int> ans(n + 1);
  ans[1] = 1;
  vector<bool> vis(n + 1);
  for (int i = 1; i <= n; ++i) cin >> v[i].first >> v[i].second;
  int n1 = v[1].first, n2 = v[1].second;
  if (n2 == v[n1].first || n2 == v[n1].second) {
    ans[2] = n1;
    ans[3] = n2;
  } else {
    ans[3] = n1;
    ans[2] = n2;
  }
  vis[1] = vis[n1] = vis[n2] = true;
  for (int i = 2; i <= n - 2; ++i) {
    int n1 = v[ans[i]].first, n2 = v[ans[i]].second;
    if (vis[n1]) {
      ans[i + 2] = n2;
      vis[n2] = true;
    } else {
      ans[i + 2] = n1;
      vis[n1] = true;
    }
  }
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
}
