#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 100;
map<int, int> m;
map<int, int> m_;
int d[MAXN];
vector<int> N[MAXN];
bool mark[MAXN];
void dfs(int v) {
  mark[v] = 1;
  cout << m_[v] << " ";
  for (int i = 0; i < N[v].size(); i++)
    if (mark[N[v][i]] == 0) dfs(N[v][i]);
}
int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    if (m[x] == 0) {
      cnt++;
      m[x] = cnt;
      m_[cnt] = x;
    }
    if (m[y] == 0) {
      cnt++;
      m[y] = cnt;
      m_[cnt] = y;
    }
    x = m[x];
    y = m[y];
    d[x]++;
    d[y]++;
    N[x].push_back(y);
    N[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    if (d[i] == 1) {
      dfs(i);
      cout << endl;
      return 0;
    }
}
