#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int nax = 2e6 + 7;
const long long mod = 1e9 + 7;
const int N = 100100;
using namespace std;
map<long long, bool> visit;
map<long long, long long> cnt;
map<long long, vector<long long> > v;
void dfs(long long x) {
  visit[x] = true;
  cout << x << " ";
  for (long long i = 0; i < (int)v[x].size(); i++) {
    if (visit[v[x][i]] == false) dfs(v[x][i]);
  }
}
int main(int argc, char** argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
    cnt[x]++;
    cnt[y]++;
    visit[x] = false;
    visit[y] = false;
  }
  long long pos;
  for (auto it = cnt.begin(); it != cnt.end(); it++) {
    if (it->second == 1) {
      pos = it->first;
      break;
    }
  }
  dfs(pos);
  return 0;
}
