#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, t1, t2, prev;
  vector<pair<int, int> > v;
  scanf("%d", &n);
  v.resize(n);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &t1, &t2);
    v[i] = make_pair(t1 - 1, t2 - 1);
  }
  printf("1 ");
  if ((v[v[0].first].first == v[0].second) ||
      (v[v[0].first].second == v[0].second)) {
    printf("%d ", v[0].first + 1);
    i = v[0].first;
    prev = v[0].second;
  } else {
    printf("%d ", v[0].second + 1);
    i = v[0].second;
    prev = v[0].first;
  }
  n -= 2;
  while (n > 0) {
    t1 = v[i].first;
    t2 = v[i].second;
    printf("%d ", prev + 1);
    i = prev;
    if (t1 != prev) {
      prev = t1;
    } else {
      prev = t2;
    }
    n--;
  }
  return 0;
}
