#include <bits/stdc++.h>
using namespace std;
bool contain(const pair<int, int> &a, const int &b) {
  return a.first == b || a.second == b;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n == 3) {
    cout << "1 2 3";
    return 0;
  }
  vector<pair<int, int> > v(n);
  vector<int> nxt(n, -1);
  for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
  for (int i = 0; i < n; i++) {
    if (contain(v[v[i].second - 1], v[i].first))
      nxt[i] = v[i].second - 1;
    else
      nxt[i] = v[i].first - 1;
  }
  cout << 1;
  int cur = nxt[0];
  while (cur != 0) {
    cout << " " << cur + 1;
    cur = nxt[cur];
  }
  return 0;
}
