#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > a(100000);
int main() {
  int i, j, k, l, m, n, x, y, s, p, temp, x1, y1, ind, cnt;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    x1 = x % 100000;
    y1 = y % 100000;
    a[x1].push_back({x, y});
    a[y1].push_back({y, x});
  }
  int f = 0;
  for (i = 0; i < 100000; i++) sort(a[i].begin(), a[i].end());
  for (i = 0; i < 100000; i++) {
    j = 0;
    while (j < a[i].size()) {
      k = a[i][j].first;
      if (j + 1 < a[i].size() && a[i][j + 1].first == k) {
        j += 2;
      } else {
        s = k;
        p = a[i][j].second;
        f = 1;
        break;
      }
    }
    if (f == 1) break;
  }
  cout << s << " " << p << " ";
  while (1) {
    ind = p % 100000;
    f = 0;
    for (i = 0; i < a[ind].size(); i++) {
      if (a[ind][i].first == p && a[ind][i].second != s) {
        s = p;
        p = a[ind][i].second;
        f = 1;
        cout << p << " ";
      }
    }
    if (f == 0) break;
  }
  cout << endl;
  return 0;
}
