#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[200010][2];
  for (int i = 1; i <= n; i++) cin >> a[i][0] >> a[i][1];
  vector<int> v;
  int j = 0;
  int i = 1;
  if (n == 3)
    cout << 1 << " " << 2 << " " << 3;
  else {
    while (j < n) {
      if (a[a[i][0]][0] == a[i][1] || a[a[i][0]][1] == a[i][1])
        i = a[i][0];
      else if (a[a[i][1]][0] == a[i][0] || a[a[i][1]][1] == a[i][0])
        i = a[i][1];
      v.push_back(i);
      j++;
    }
    for (int i = 1; i <= n; i++) cout << v[i - 1] << " ";
  }
  return 0;
}
