#include <bits/stdc++.h>
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
using namespace std;
const int MOD = 1e9 + 7;
double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }
template <typename T>
T mymax(T a, T b) {
  return (a > b) ? a : b;
}
template <typename T>
T mymax(T a, T b, T c) {
  return mymax(a, mymax(b, c));
}
template <typename T>
T mymin(T a, T b) {
  return (a < b) ? a : b;
}
template <typename T>
T mymin(T a, T b, T c) {
  return mymin(a, mymin(b, c));
}
template <typename T>
T power(T x, T y) {
  T res = 1;
  x = x % MOD;
  while (y > 0) {
    if (y & 1) res = (res * x) % MOD;
    y = y >> 1;
    x = (x * x) % MOD;
  }
  return res;
}
template <typename T>
void swap(T *x, T *y) {
  T temp;
  temp = *y;
  *y = *x;
  *x = temp;
}
template <typename T>
T mod(T a) {
  if (a > 0)
    return a;
  else
    return -a;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<pair<int, int>> p;
  int ans[n + 1];
  p.push_back({0, 0});
  for (int j = 1; j <= n; j++) {
    int a, b;
    cin >> a >> b;
    p.push_back({a, b});
  }
  if (n == 3) {
    if (p[1].first == 3 && p[1].second == 2)
      cout << "1 3 2\n";
    else
      cout << "1 2 3\n";
    return 0;
  }
  int c = 0, i = 1, a, b, a1, a2, b1, b2;
  while (c <= n - 1) {
    a = p[i].first;
    b = p[i].second;
    a1 = p[a].first;
    a2 = p[a].second;
    b1 = p[b].first;
    b2 = p[b].second;
    if (a == a1 || a == a2 || b == a1 || b == a2) {
      ans[i] = a;
      i = a;
    } else {
      ans[i] = b;
      i = b;
    }
    c++;
  }
  c = 0;
  cout << 1 << " ";
  i = 1;
  while (c <= n - 1) {
    if (ans[i] != 1) cout << ans[i] << " ";
    c++;
    i = ans[i];
  }
  return 0;
}
