#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
int A[MAXN][2], ans[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A[i][0] >> A[i][1];
  }
  if (n == 3) {
    cout << "1 2 3";
    return 0;
  }
  int nxt = 0, idx = 1;
  ans[nxt] = idx;
  nxt++;
  while (nxt < n) {
    int a1 = A[idx][0];
    int a11 = A[a1][0];
    int a12 = A[a1][1];
    int a2 = A[idx][1];
    if (a11 == a2 || a12 == a2) {
      ans[nxt] = a1;
      idx = a1;
      nxt++;
    } else {
      ans[nxt] = a2;
      idx = a2;
      nxt++;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
}
