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