#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int mod = 1e9 + 7;
inline int bigmod(int B, int P) {
  int R = 1;
  while (P > 0) {
    if (P & 1) {
      R = (R * B) % mod;
    }
    P >>= 1;
    B = (B * B) % mod;
  }
  return R;
}
const int mxn = 2e5 + 10;
vector<int> adj[mxn];
int cnt, N;
vector<int> ans;
int vis[mxn];
void dfs(int n) {
  while (cnt != N) {
    ans.push_back(n);
    vis[n] = 1;
    cnt++;
    int a = adj[n][0], b = adj[n][1];
    if ((adj[a][0] == b || adj[a][1] == b) && !vis[a])
      dfs(a);
    else
      dfs(b);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int tt = 1;
  for (int tc = 1; tc <= tt; tc++) {
    cin >> N;
    for (int i = 1; i <= N; i++) {
      int u, v;
      cin >> u >> v;
      adj[i].push_back(u);
      adj[i].push_back(v);
    }
    dfs(1);
    for (int x : ans) cout << x << " ";
  }
  return 0;
}
