#include <bits/stdc++.h>
using namespace std;
int n;
int a[200000 + 5];
vector<int> g[200000 + 5];
int cnt = 0;
void dfs(int x, int fa) {
  cnt++;
  if (cnt > n) return;
  printf("%d ", x);
  for (int i = 0; i < g[x].size(); i++) {
    int y = g[x][i];
    if (y == fa) continue;
    dfs(y, x);
  }
}
int main() {
  scanf("%d", &n);
  int xx, yy;
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d", &x), scanf("%d", &y);
    if (i == 1) xx = x, yy = y;
    g[y].push_back(x), g[x].push_back(y);
  }
  if (g[1][0] != xx && g[1][0] != yy) swap(g[1][0], g[1][1]);
  dfs(1, 0);
  return 0;
}
