#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int n;
  scanf("%d", &n);
  vector<int> a[n + 7];
  for (int i = 1; i <= n; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    a[x].push_back(i);
    a[y].push_back(i);
  }
  if (n == 3) {
    printf("1 2 3\n");
  } else {
    int next[n + 7];
    for (int i = 1; i <= n; ++i) {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          if (a[a[i][j]][k] == a[i][(j + 1) % 2]) {
            next[a[i][(j + 1) % 2]] = i;
            next[a[a[i][j]][k]] = a[i][j];
          }
        }
      }
    }
    int x = 1;
    for (int i = 0; i < n; ++i) {
      printf("%d ", x);
      x = next[x];
    }
  }
  return 0;
}
