#include <bits/stdc++.h>
using namespace std;
const int N = 1e9 + 7;
map<int, vector<int> > adj;
bitset<N> vis;
void dfs(int u) {
  vis[u] = 1;
  printf("%d ", u);
  for (int v : adj[u]) {
    if (vis[v] == 0) dfs(v);
  }
}
int main() {
  int T, i, j;
  int n, u, v;
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  int s;
  for (map<int, vector<int> >::iterator itr = adj.begin(); itr != adj.end();
       itr++) {
    int x = itr->first;
    vector<int> v = itr->second;
    if (v.size() == 1) {
      s = x;
      break;
    }
  }
  dfs(s);
  printf("\n");
  return 0;
}
