#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
long long quick_pow(long long a, int n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = ans * a;
    n /= 2;
    a = a * a % mod;
  }
  return ans;
}
pair<int, int> p[maxn];
int n, f, ans[maxn];
void dfs(int st, int last, int num) {
  if (f) return;
  if (num == n + 1) {
    f = 1;
    return;
  }
  ans[num] = st;
  if (last == -1) {
    dfs(p[st].first, p[st].second, num + 1);
    dfs(p[st].second, p[st].first, num + 1);
  } else {
    if (p[st].first == last)
      dfs(p[st].first, p[st].second, num + 1);
    else if (p[st].second == last)
      dfs(p[st].second, p[st].first, num + 1);
  }
}
int main() {
  int st, en;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &st, &en);
    p[i] = make_pair(st, en);
  }
  dfs(1, -1, 1);
  for (int i = 1; i <= n; i++) printf("%d%c", ans[i], i == n ? '\n' : ' ');
  return 0;
}
