#include <bits/stdc++.h>
using namespace std;
const int inf = 2e5 + 7;
int head[inf], cnt = 0;
struct node {
  int from, to;
  int nxt;
} arr[2 * inf];
int ans[inf];
void addedge(int a, int b) {
  arr[cnt].from = a;
  arr[cnt].to = b;
  arr[cnt].nxt = head[a];
  head[a] = cnt++;
}
int main() {
  memset(head, -1, sizeof(head));
  int n;
  int a, b, aa, bb;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a, &b);
    if (i == 0) aa = a, bb = b;
    addedge(a, b);
    addedge(b, a);
  }
  int one = 1, flag = 0;
  int thenow = 2e5 + 7;
  int p = 0;
  while (one != 1 || flag == 0) {
    flag = 1;
    ans[p++] = one;
    for (int i = head[one]; i != -1; i = arr[i].nxt) {
      int to1 = arr[i].to;
      if (to1 != thenow) {
        thenow = one;
        one = to1;
        goto x;
      }
    }
  x:;
  }
  if (ans[1] == aa || ans[2] == aa) {
    for (int i = 0; i < n; i++) printf("%d ", ans[i]);
    printf("\n");
  } else {
    for (int i = n - 1; i >= 0; i--) printf("%d ", ans[i]);
    printf("\n");
  }
  return 0;
}
