#include <bits/stdc++.h>
using namespace std;
int pr[300005];
pair<int, int> ch[300005];
int find(int x) { return pr[x] ? pr[x] = find(pr[x]) : x; }
void dfs(int x, int n) {
  if (x <= n) {
    cout << x << " ";
    return;
  }
  dfs(ch[x].first, n);
  dfs(ch[x].second, n);
}
int main() {
  int n, x, y, u, v;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    u = find(x);
    v = find(y);
    pr[u] = pr[v] = n + i;
    ch[n + i] = make_pair(u, v);
  }
  dfs(find(n), n);
  return 0;
}
