#include <bits/stdc++.h>
using namespace std;
void Suhaib_Sawalha() {
  int n;
  cin >> n;
  int remember[n + 1][2], a1 = -1, a2 = -1, u, v;
  for (int i = 1; i <= n; ++i) {
    cin >> u >> v;
    remember[i][0] = u;
    remember[i][1] = v;
    if (v == 1) swap(u, v);
    if (u == 1) {
      if (a1 == -1)
        a1 = v;
      else
        a2 = v;
    }
  }
  vector<int> ans = {1};
  int x = remember[1][0];
  int y = remember[1][1];
  if (a1 == x || a2 == x) {
    ans.push_back(x);
    ans.push_back(y);
  } else {
    ans.push_back(y);
    ans.push_back(x);
  }
  for (int i = 1; i < n - 2; ++i) {
    int x = remember[ans[i]][0];
    int y = remember[ans[i]][1];
    if (ans[i + 1] == x)
      ans.push_back(y);
    else
      ans.push_back(x);
  }
  for (auto f : ans) cout << f << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int _;
  Suhaib_Sawalha();
  return 0;
}
