#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200005;
const int INF = 0x3f3f3f3f;
template <typename T>
void debug(initializer_list<T> text) {
  for (auto val : text) cerr << val << " ";
  cerr << endl;
}
int N;
pair<int, int> nexts[MAX_N];
int Next[MAX_N];
void solve(int l, int r) {
  vector<int> ans;
  for (int i = (1); i <= (N); i++) {
    int nxt = -1;
    if (nexts[l].first == r)
      nxt = nexts[l].second;
    else if (nexts[l].second == r)
      nxt = nexts[l].first;
    else
      return;
    l = r;
    r = nxt;
    ans.push_back(nxt);
  }
  for (auto val : ans) printf("%d ", val);
  puts("");
  exit(0);
}
int main() {
  scanf("%d", &N);
  for (int i = (1); i <= (N); i++)
    scanf("%d%d", &nexts[i].first, &nexts[i].second);
  solve(1, nexts[1].first);
  solve(1, nexts[1].second);
  return 0;
}
