#include <bits/stdc++.h>
using namespace std;
const int N = 2 * (1e5) + 1;
int arr[N][2];
int32_t main() {
  ios_base::sync_with_stdio(false);
  ;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i][0] >> arr[i][1];
  }
  vector<int> ans;
  ans.push_back(1);
  int a = arr[1][0], b = arr[1][1];
  if (arr[a][0] == b || arr[a][1] == b) {
    ans.push_back(a);
  } else {
    ans.push_back(b);
  }
  int j = 0;
  while (ans.size() < n) {
    if (arr[ans[j]][0] == ans[j + 1]) {
      ans.push_back(arr[ans[j]][1]);
    } else {
      ans.push_back(arr[ans[j]][0]);
    }
    j++;
  }
  for (auto in : ans) {
    cout << in << " ";
  }
  cout << "\n";
  return 0;
}
