#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  int arr[n + 1][2];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i][0] >> arr[i][1];
  }
  vector<int> sol;
  sol.push_back(1);
  while (sol.size() < n) {
    int last = sol.size() - 1;
    last = sol[last];
    int a = arr[last][0];
    int b = arr[last][1];
    if (arr[a][0] == b || arr[a][1] == b) {
      sol.push_back(a);
      sol.push_back(b);
    } else {
      sol.push_back(b);
      sol.push_back(a);
    }
  }
  for (int i = 0; i < n; i++) {
    cout << sol[i] << " ";
  }
  return 0;
}
