#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
int inf = 1e9;
double eps = 1e-2;
ifstream in("input.txt");
ofstream out("output.txt");
vector<int> loop;
vector<pair<int, int>> rem;
int main() {
  int n;
  cin >> n;
  rem.resize(n);
  loop.resize(n);
  for (int i = 0; i < n; i++) {
    int u, v;
    cin >> u >> v;
    rem[i] = make_pair(u - 1, v - 1);
  }
  if (n == 3) {
    cout << "1 2 3";
    return 0;
  }
  loop[0] = 0;
  for (int i = 0; i < n - 1; i++) {
    int u = rem[loop[i]].first;
    int v = rem[loop[i]].second;
    if (rem[u].first == v) {
      loop[i + 1] = u;
    } else if (rem[u].second == v) {
      loop[i + 1] = u;
    } else {
      loop[i + 1] = v;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << loop[i] + 1 << " ";
  }
  return 0;
}
