#include <bits/stdc++.h>
using namespace std;
const int Mx = 200005;
int N;
vector<pair<int, int> > v(Mx);
vector<int> ans;
int vis[Mx];
void dfs(int u) {
  int x = v[u].first, y = v[u].second;
  if (vis[u]) return;
  vis[u] = 1;
  cout << u << ' ';
  if (y == v[x].first or y == v[x].second) {
    dfs(x);
  }
  if (x == v[y].first or x == v[y].second) {
    dfs(y);
  }
}
void solve() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> v[i].first >> v[i].second;
  }
  dfs(1);
  cout << endl;
}
int32_t main() {
  int tt;
  tt = 1;
  int cas = 1;
  while (tt--) {
    solve();
  }
}
