#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<vector<long long>> v(n + 1, vector<long long>(2));
  for (long long i = 1; i <= n; i++) cin >> v[i][0] >> v[i][1];
  if (n == 3) {
    cout << "1 2 3";
    return 0;
  }
  vector<long long> ans;
  long long i = 1;
  ans.push_back(i);
  while (true) {
    long long x = v[i][0], y = v[i][1];
    if (v[x][0] == y || v[x][1] == y) {
      ans.push_back(x);
      i = x;
    } else if (v[y][0] == x || v[y][1] == x) {
      ans.push_back(y);
      i = y;
    }
    if (i == 1) break;
  }
  for (long long i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
