#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<int>> v;
void check(int l, int r) {
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    int nxt = -1;
    if (v[l][0] == r) {
      nxt = v[l][1];
    } else if (v[l][1] == r) {
      nxt = v[l][0];
    } else
      return;
    ans.push_back(nxt);
    l = r;
    r = nxt;
  }
  for (auto it : ans) {
    cout << it + 1 << " ";
  }
  exit(0);
}
int main() {
  cin >> n;
  v = vector<vector<int>>(n, vector<int>(2));
  for (int i = 0; i < n; ++i) {
    cin >> v[i][0] >> v[i][1];
    --v[i][0];
    --v[i][1];
  }
  check(0, v[0][1]);
  check(0, v[0][0]);
}
