#include <bits/stdc++.h>
using namespace std;
map<int, vector<int> > m;
int n;
void dfs(int v, int p) {
  if (~p) printf(" ");
  printf("%d", v + 1);
  for (int(i) = 0; (i) < ((int)m[v].size()); ++(i))
    if (m[v][i] != p) dfs(m[v][i], v);
}
int main() {
  scanf("%d", &n);
  for (int(i) = 0; (i) < (n); ++(i)) {
    int p, q;
    scanf("%d%d", &p, &q);
    --p;
    --q;
    m[p].push_back(q);
    m[q].push_back(p);
  }
  for (map<int, vector<int> >::iterator it = m.begin(); it != m.end(); ++it)
    if ((int)it->second.size() == 1) {
      dfs(it->first, -1);
      cout << endl;
      exit(0);
    }
}
