#include <bits/stdc++.h>
using namespace std;
int n;
map<int, vector<int> > g;
void dfs(int root, int par) {
  cout << root + 1 << " ";
  for (int c : g[root]) {
    if (c != par) dfs(c, root);
  }
}
void code() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int root = -1;
  for (auto p : g) {
    if (p.second.size() == 1) {
      root = p.first;
      break;
    }
  }
  dfs(root, -1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    code();
  }
}
