#include <bits/stdc++.h>
const int maxn = 2e5 + 5;
using namespace std;
int a[maxn], b[maxn], c[maxn];
void DFS(int n, int m);
int p;
int main() {
  std::ios::sync_with_stdio(false);
  memset(c, 0, sizeof(c));
  cin >> p;
  for (int i = 1; i <= p; i++) {
    cin >> a[i] >> b[i];
  }
  c[1] = 1;
  cout << "1 ";
  DFS(1, 1);
}
void DFS(int n, int m) {
  if (n == p) return;
  int x = a[m];
  int y = b[m];
  if (!c[x] && (a[x] == y || b[x] == y)) {
    c[x] = 1;
    cout << x << " ";
    DFS(n + 1, x);
  } else {
    c[y] = 1;
    cout << y << " ";
    DFS(n + 1, y);
  }
}
