#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
const double pi = acos(-1);
const int mod = 1e9 + 7;
long long fastpow(long long b, long long e) {
  if (!e) return 1;
  long long ret = fastpow(b, e / 2);
  ret = (ret * ret) % mod;
  if (e % 2) ret = (ret * b) % mod;
  return ret;
}
long long mi(int x) { return fastpow(x, mod - 2); }
int main() {
  int n;
  scanf("%d", &n);
  map<int, vector<int> > m;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    m[x].push_back(y);
    m[y].push_back(x);
  }
  set<int> vis;
  queue<int> q;
  for (map<int, vector<int> >::iterator it = m.begin(); it != m.end(); it++) {
    if ((it->second).size() == 1) {
      q.push(it->first);
      break;
    }
  }
  while (q.size()) {
    int x = q.front();
    q.pop();
    if (vis.find(x) != vis.end()) continue;
    vis.insert(x);
    printf("%d ", x);
    for (int i = 0; i < m[x].size(); i++) q.push(m[x][i]);
  }
  return 0;
}
