#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
vector<int> V[N];
map<int, int> m;
int sor[N], vis[N];
int n;
int dfs(int u, int step) {
  if (step == n + 1) {
    printf("%d", sor[u]);
    return 1;
  }
  for (int i = 0; i < V[u].size(); i++) {
    if (!vis[V[u][i]]) {
      vis[V[u][i]] = 1;
      if (dfs(V[u][i], step + 1)) {
        printf(" %d", sor[u]);
        return 1;
      }
    }
  }
  return 0;
}
int main() {
  while (scanf("%d", &n) != EOF) {
    memset(vis, 0, sizeof(vis));
    int a, b, pos = 0;
    for (int i = 0; i < N; i++) {
      V[i].clear();
    }
    m.clear();
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &a, &b);
      if (!m[a]) m[a] = ++pos, sor[pos] = a;
      if (!m[b]) m[b] = ++pos, sor[pos] = b;
      V[m[a]].push_back(m[b]);
      V[m[b]].push_back(m[a]);
    }
    int start = 1;
    for (int i = 1; i < n; i++) {
      if (V[i].size() == 1) {
        start = i;
        break;
      }
    }
    vis[start] = 1;
    dfs(start, 1);
    printf("\n");
  }
  return 0;
}
