#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 3;
int n;
int sum;
int s, t;
int city[MAXN];
bool vis[MAXN];
map<int, int> mp;
vector<int> v[MAXN];
struct mail {
  int a, b;
} m[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> m[i].a >> m[i].b;
    if (!mp[m[i].a]) {
      mp[m[i].a] = ++sum;
      city[sum] = m[i].a;
    }
    if (!mp[m[i].b]) {
      mp[m[i].b] = ++sum;
      city[sum] = m[i].b;
    }
    v[mp[m[i].a]].push_back(mp[m[i].b]);
    v[mp[m[i].b]].push_back(mp[m[i].a]);
  }
  bool flag = 0;
  for (int i = 1; i <= sum; i++) {
    if (v[i].size() == 1 && !flag) {
      s = i;
      flag = 1;
    }
    if (v[i].size() == 1 && flag) {
      t = i;
      break;
    }
  }
  cout << city[s] << ' ';
  for (int i = 1; i <= sum; i++) {
    vis[s] = 1;
    for (int j = 0; j <= v[s].size() - 1; j++) {
      if (!vis[v[s][j]]) {
        cout << city[v[s][j]] << ' ';
        vis[v[s][j]] = 1;
        s = v[s][j];
        break;
      }
    }
  }
  cout << "\n";
  return 0;
}
