#include <bits/stdc++.h>
const long long way[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
using namespace std;
const long long INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double EXP = 1e-8;
const long long MOD = 1e9 + 7;
const long long N = 2e5 + 5;
long long n, a[N], b[N], c[N];
void dfs(long long u, long long v) {
  if (u == n) return;
  long long x = a[v], y = b[v];
  if (!c[x] && (a[x] == y || b[x] == y)) {
    cout << x << " ";
    c[x] = 1;
    dfs(u + 1, x);
  } else {
    c[y] = 1;
    cout << y << " ";
    dfs(u + 1, y);
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i] >> b[i];
  cout << 1 << " ";
  c[1] = 1;
  dfs(1, 1);
  return 0;
}
