#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1E-9;
const long long INF = (long long)1E9;
const long long INF64 = (long long)1E18;
map<int, bool> vis;
map<long long, vector<long long> > v;
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < (long long)(n); i++) {
    long long a, b;
    cin >> a >> b;
    a--, b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  long long pos = 0;
  map<long long, vector<long long> >::iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if ((*it).second.size() == 1) {
      pos = (*it).first;
      break;
    }
  }
  queue<long long> q;
  q.push(pos);
  while (q.size() > 0) {
    long long tem = q.front();
    q.pop();
    if (vis[tem] == 0) {
      cout << tem + 1 << " ";
      for (long long i = 0; i < (long long)(v[tem].size()); i++) {
        if (vis[v[tem][i]] == 0) q.push(v[tem][i]);
      }
    }
    vis[tem] = 1;
  }
}
