#include <bits/stdc++.h>
using namespace std;
struct node {
  int f, s;
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, temp;
  cin >> n;
  if (n == 3) {
    cout << "1 2 3";
    return 0;
  }
  node a[n + 1];
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].f >> a[i].s;
  }
  vector<int> adj[n + 1];
  for (int i = 1; i <= n; ++i) {
    temp = a[i].f;
    if (a[temp].f == a[i].s or a[temp].s == a[i].s)
      adj[i].push_back(temp);
    else
      adj[i].push_back(a[i].s);
  }
  auto it = adj[1].begin();
  for (int i = 1; i <= n; ++i) {
    cout << *it << " ";
    it = adj[*it].begin();
  }
}
