#include <bits/stdc++.h>
using namespace std;
long long big_mod(long long a, long long b, long long c) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long d = big_mod(a, b / 2, c);
    return ((d * d) % c);
  }
  return (((a % c) * big_mod(a, b - 1, c)) % c);
}
int inp[200007][2];
int ara[200007];
vector<int> vc;
int main() {
  int test;
  long long n, sum = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    inp[i][0] = a;
    inp[i][1] = b;
  }
  if (n == 3) {
    cout << "1 2 3\n";
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    int a = inp[i][0];
    int b = inp[i][1];
    if ((inp[a][0] == b || inp[a][1] == b) && (ara[a] == 0)) {
      ara[a] = b;
    } else {
      ara[b] = a;
    }
  }
  int a = 1;
  vc.push_back(1);
  while (1) {
    int b = ara[a];
    if (b == 1) break;
    vc.push_back(b);
    a = b;
  }
  for (int i = 0; i < vc.size(); i++) {
    cout << vc[i] << " ";
  }
  cout << '\n';
  return 0;
}
