#include <bits/stdc++.h>
using namespace std;
int main() {
  long c[200001];
  vector<long> a1, a2;
  long n, i, k;
  a1.push_back(-1);
  a2.push_back(-1);
  cin >> n;
  for (i = 1; i <= n; i++) {
    long x, y;
    cin >> x >> y;
    a1.push_back(x);
    a2.push_back(y);
  }
  c[1] = 1;
  if (a1[a1[1]] == a2[1] || a2[a1[1]] == a2[1]) {
    c[2] = a1[1];
    c[3] = a2[1];
  } else {
    c[2] = a2[1];
    c[3] = a1[1];
  }
  k = 3;
  for (i = 2; i <= n - 2; i++) {
    if (c[i + 1] == a1[c[i]])
      c[++k] = a2[c[i]];
    else
      c[++k] = a1[c[i]];
  }
  for (i = 1; i <= n; i++) cout << c[i] << ' ';
  return 0;
}
