#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int a[N], b[N];
bool vis[N];
int n, last = 1;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
  cout << "1 ";
  for (int i = 2; i <= n; i++) {
    vis[last] = 1;
    int x = a[last];
    int y = b[last];
    if ((a[x] == y || b[x] == y) && !vis[x]) {
      cout << x << " ";
      last = x;
    } else {
      cout << y << " ";
      last = y;
    }
  }
  cout << endl;
  return 0;
}
