#include <bits/stdc++.h>
using namespace std;
vector<int> vec[100005];
int vis[100005];
map<int, int> mp, mp2;
int flag = 0;
int root;
void dfs(int now) {
  vis[now] = 1;
  if (flag == 0) {
    printf("%d", mp2[now]);
    flag = 1;
  } else
    printf(" %d", mp2[now]);
  flag = 1;
  for (int i = 0; i < vec[now].size(); i++) {
    if (!vis[vec[now][i]]) {
      dfs(vec[now][i]);
    }
  }
}
void findroot(int now) {
  if (root != -1) return;
  vis[now] = 1;
  int flag1 = 0;
  for (int i = 0; i < vec[now].size(); i++) {
    if (!vis[vec[now][i]]) {
      flag1 = 1;
      findroot(vec[now][i]);
    }
  }
  if (flag1 == 0) {
    root = now;
    return;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int u, v;
  int id = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &u, &v);
    int pos1, pos2;
    if (mp.count(u) == 0) {
      mp[u] = id;
      id++;
      mp2[id - 1] = u;
    }
    if (mp.count(v) == 0) {
      mp[v] = id;
      id++;
      mp2[id - 1] = v;
    }
    pos1 = mp[u], pos2 = mp[v];
    vec[pos1].push_back(pos2);
    vec[pos2].push_back(pos1);
  }
  root = -1;
  memset(vis, 0, sizeof(vis));
  findroot(mp[u]);
  memset(vis, 0, sizeof(vis));
  dfs(root);
  puts("");
  return 0;
}
