#include <bits/stdc++.h>
using namespace std;
map<int, bool> vis;
map<int, vector<int>> AdjList;
vector<int> Route;
int n, e, u, v;
void CreatingAdjListGraph() {
  cin >> e;
  for (int i = 0; i < e; ++i) {
    cin >> u >> v;
    AdjList[u].push_back(v);
    AdjList[v].push_back(u);
  }
}
void DFSRec(int root) {
  Route.push_back(root);
  vis[root] = 1;
  for (auto v : AdjList[root]) {
    if (!vis[v]) DFSRec(v);
  }
}
void FindingOneDegreenNode() {
  for (auto i : AdjList) {
    if (i.second.size() == 1) DFSRec(i.first);
  }
}
void Output() {
  for (int i = 1; i < Route.size(); ++i) {
    cout << Route[i - 1] << " ";
  }
  cout << endl;
}
int main() {
  CreatingAdjListGraph();
  FindingOneDegreenNode();
  Output();
  return 0;
}
