#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> p[212345];
vector<long long> ans;
bool vis[212345];
void dfs(long long v) {
  ans.push_back(v);
  vis[v] = 1;
  long long &f = p[v].first;
  long long &s = p[v].second;
  if (p[f].first == s || p[f].second == s) {
    if (vis[f]) return;
    dfs(f);
  }
  if (vis[s]) return;
  dfs(s);
}
signed main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    p[i] = make_pair(x, y);
  }
  if (n == 3) {
    cout << "1 2 3" << endl;
    return 0;
  }
  dfs(1);
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i] << ' ';
  }
  cout << endl;
  return 0;
}
