#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int to[maxn][4];
int n;
int nex[maxn];
bool vis[maxn];
void dfs(int a) {
  printf("%d ", a);
  vis[a] = true;
  if (!vis[nex[a]]) dfs(nex[a]);
}
int main() {
  scanf("%d", &n);
  if (n == 3) {
    printf("1 2 3\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &to[i][1], &to[i][2]);
  }
  for (int i = 1; i <= n; i++) {
    int &a = to[i][1];
    int &b = to[i][2];
    if (to[a][1] == b || to[a][2] == b) {
      nex[i] = a;
    } else
      nex[i] = b;
  }
  memset(vis, false, sizeof(vis));
  dfs(1);
  return 0;
}
