#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g(200005);
bool vis[200005];
int fa, fb;
void dfs(int u) {
  if (u != 1) printf(" ");
  printf("%d", u);
  for (int v : g[u]) {
    if (!vis[v]) {
      if (u == 1 && v != fa && v != fb) continue;
      vis[v] = true;
      dfs(v);
      break;
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (i == 0) {
      fa = a;
      fb = b;
    }
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vis[1] = true;
  dfs(1);
  printf("\n");
  return 0;
}
