#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<vector<int> > nodes(n);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    nodes[i].push_back(a);
    nodes[i].push_back(b);
  }
  vector<int> answ;
  answ.push_back(0);
  vector<bool> used(n);
  while (answ.size() <= n) {
    int cur = answ[answ.size() - 1];
    int a = nodes[cur][0];
    int b = nodes[cur][1];
    if (nodes[a][0] == b || nodes[a][1] == b) {
      answ.push_back(a);
      answ.push_back(b);
    } else {
      answ.push_back(b);
      answ.push_back(a);
    }
  }
  for (int i = 0; i < answ.size(); i++) {
    if (used[answ[i]] == 1) break;
    used[answ[i]] = 1;
    cout << answ[i] + 1 << " ";
  }
  return 0;
}
