#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a[1000000];
int vi[1000000];
pair<int, int> b[1000000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int z, zz;
  int t, tt;
  for (int i = 1; i <= n; ++i) {
    cin >> z >> zz;
    b[i] = make_pair(z, zz);
    if (i == 0) {
      t = z;
      tt = zz;
    }
    a[z].push_back(zz);
    a[zz].push_back(z);
  }
  cout << 1 << " ";
  int o = 1;
  vi[1] = 1;
  if (a[o][0] == b[o].first || a[o][0] == b[o].second) {
    cout << a[o][0] << " ";
    vi[a[o][0]] = 1;
    o = a[o][0];
  } else {
    cout << a[o][1] << " ";
    vi[a[o][1]] = 1;
    o = a[o][1];
  }
  for (int i = 2; i < n; ++i) {
    if (!vi[a[o][0]] && (a[o][0] == b[o].first || a[o][0] == b[o].second)) {
      cout << a[o][0] << " ";
      vi[a[o][0]] = 1;
      o = a[o][0];
    } else {
      cout << a[o][1] << " ";
      vi[a[o][1]] = 1;
      o = a[o][1];
    }
  }
  return 0;
}
