#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> arr[200005];
int main() {
  cin.sync_with_stdio(false), cin.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> arr[i].first >> arr[i].second;
  }
  if (n == 3) {
    cout << 1 << " " << 2 << " " << 3 << endl;
    return 0;
  }
  int x = 1;
  vector<int> ans;
  ans.push_back(1);
  while (true) {
    int node = arr[x].first;
    if (arr[node].first == arr[x].second || arr[node].second == arr[x].second) {
      ans.push_back(node);
      ans.push_back(arr[x].second);
      x = arr[x].second;
    } else {
      ans.push_back(arr[x].second);
      ans.push_back(node);
      x = node;
    }
    if (ans.size() >= n) {
      break;
    }
  }
  for (long long i = 0; i < ans.size(); ++i) {
    if (ans[i] == 1 && i != 0) {
      break;
    }
    cout << ans[i] << " ";
  }
}
