#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18 + 123;
const long double EPS = 1e-9;
const int MX = 1e9 + 1;
const int INF = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 1e5 + 123;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
map<int, vector<int> > m;
map<int, bool> used;
vector<int> v;
void dfs(int v) {
  used[v] = 1;
  cout << v << " ";
  for (int i = 0; i < m[v].size(); ++i) {
    if (!used[m[v][i]]) {
      dfs(m[v][i]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int x, y;
    cin >> x >> y;
    m[x].push_back(y);
    m[y].push_back(x);
    v.push_back(x);
    v.push_back(y);
    used[x] = 0;
    used[y] = 0;
  }
  for (int i = 0; i < v.size(); ++i) {
    if (m[v[i]].size() == 1) {
      dfs(v[i]);
      break;
    }
  }
  return 0;
}
