#include <bits/stdc++.h>
using namespace std;
long long int inf = 1e9 + 7;
int main() {
  long long int n;
  cin >> n;
  vector<pair<long long int, long long int> > arr(n + 1);
  for (long long int i = 1; i < n + 1; i++) {
    long long int a, b;
    cin >> a >> b;
    arr[i].first = a;
    arr[i].second = b;
  }
  vector<long long int> ans(n + 1);
  ans[1] = 1;
  long long int x, y;
  x = arr[1].first;
  y = arr[1].second;
  if (arr[x].first == y or arr[x].second == y) {
    ans[2] = x;
    ans[3] = y;
    long long int i = 3;
    while (i != n) {
      i++;
      long long int a = arr[ans[i - 2]].first;
      long long int b = arr[ans[i - 2]].second;
      ans[i] = (a == ans[i - 1] ? b : a);
    }
    for (int i = 1; i < ans.size(); i++) {
      cout << ans[i] << " ";
    }
    return 0;
  } else {
    ans[2] = y;
    ans[3] = x;
    long long int i = 3;
    while (i != n) {
      i++;
      long long int a = arr[ans[i - 2]].first;
      long long int b = arr[ans[i - 2]].second;
      ans[i] = (a == ans[i - 1] ? b : a);
    }
    for (int i = 1; i < ans.size(); i++) {
      cout << ans[i] << " ";
    }
    return 0;
  }
  return 0;
}
