#include <bits/stdc++.h>
using namespace std;
int c[202000];
map<int, int> mp1, mp2, num;
int main() {
  int n, a, b;
  queue<int> qu;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    c[i] = a;
    c[i + n] = b;
    if (mp1[a] == 0) {
      mp1[a] = b;
    } else
      mp2[a] = b;
    if (mp1[b] == 0)
      mp1[b] = a;
    else
      mp2[b] = a;
  }
  for (int i = 0; i < 2 * n; i++) {
    if (mp2[c[i]] == 0 || mp1[c[i]] == 0) {
      a = c[i];
      num[a]++;
      qu.push(c[i]);
      while (1) {
        if (num[mp1[a]] == 0) {
          a = mp1[a];
          num[a]++;
        } else {
          a = mp2[a];
          num[a]++;
        }
        qu.push(a);
        if (mp2[a] == 0 || mp1[a] == 0) break;
      }
      break;
    }
  }
  while (!qu.empty()) {
    printf("%d ", qu.front());
    qu.pop();
  }
  return 0;
}
