#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int a[maxn][2], ans[maxn];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i][0], &a[i][1]);
  }
  if (n == 3) {
    printf("1 2 3\n");
    return 0;
  }
  ans[1] = 1;
  for (int i = 2; i <= n; i++) {
    int pa = ans[i - 1];
    int son1 = a[pa][0], son2 = a[pa][1];
    if (a[son1][0] == son2 || a[son1][1] == son2)
      ans[i] = son1;
    else
      ans[i] = son2;
  }
  for (int i = 1; i <= n; i++) {
    printf("%d%c", ans[i], (i == n) ? '\n' : ' ');
  }
  return 0;
}
