#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n][3];
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    arr[i][0] = i + 1;
    arr[i][1] = a;
    arr[i][2] = b;
  }
  int arr2[n];
  arr2[0] = arr[0][0];
  cout << arr2[0] << " ";
  int c = 1;
  int j = 1;
  int k = 0;
  int ans[2];
  for (int i = 0; i < n - 1; i += 2) {
    int a, b = 0;
    a = arr[k][1];
    b = arr[k][2];
    if (arr[a - 1][1] == b || arr[a - 1][2] == b) {
      ans[0] = a;
      ans[1] = b;
    } else if (arr[b - 1][1] == a || arr[b - 1][2] == a) {
      ans[0] = b;
      ans[1] = a;
    }
    if (n % 2 == 0) {
      cout << ans[0] << " ";
      c++;
      if (c < n) {
        cout << ans[1] << " ";
        c++;
      }
    } else {
      cout << ans[0] << " " << ans[1] << " ";
    }
    k = ans[1] - 1;
  }
  return 0;
}
