#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200020 + 1;
pair<int, int> stamp[MAXN];
int n, dis0, dis[MAXN];
vector<int> edge[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &stamp[i].first, &stamp[i].second);
    dis[i << 1] = stamp[i].first;
    dis[(i << 1) | 1] = stamp[i].second;
  }
  sort(dis, dis + (n << 1));
  dis0 = unique(dis, dis + (n << 1)) - dis;
  for (int i = 0; i < n; i++) {
    int x = lower_bound(dis, dis + dis0, stamp[i].first) - dis;
    int y = lower_bound(dis, dis + dis0, stamp[i].second) - dis;
    edge[x].push_back(y);
    edge[y].push_back(x);
  }
  int st = 0;
  for (int i = 0; i < n; i++) {
    if ((int)edge[i].size() == 1) {
      st = i;
      break;
    }
  }
  printf("%d ", dis[st]);
  int pre = -1;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < (int)edge[st].size(); j++) {
      if (edge[st][j] == pre) continue;
      pre = st;
      st = edge[st][j];
      break;
    }
    printf("%d%c", dis[st], i ? ' ' : '\n');
  }
  return 0;
}
