#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double EPS = 1e-7;
const long long zero = 0;
int32_t main() {
  ios_base::sync_with_stdio(NULL);
  cout << fixed << setprecision(15);
  long long n;
  cin >> n;
  vector<pair<long long, long long>> a(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
    a[i].first -= 1;
    a[i].second -= 1;
  }
  long long i = 0;
  long long last = 0;
  vector<long long> res;
  res.push_back(0);
  while (res.size() < n) {
    pair<long long, long long> child = a[last];
    long long n1 = child.first;
    long long n2 = child.second;
    if (a[n1].first == n2 || a[n1].second == n2) {
      res.push_back(n1);
      res.push_back(n2);
      last = n2;
    } else if (a[n2].first == n1 || a[n2].second == n1) {
      res.push_back(n2);
      res.push_back(n1);
      last = n1;
    }
  }
  for (long long i = 0; i < n; ++i) cout << res[i] + 1 << " ";
  cout << endl;
  return 0;
}
