#include <bits/stdc++.h>
using namespace std;
int find(vector<int>& parent, int k) {
  if (parent[k] == -1) return k;
  if (parent[parent[k]] == -1) return parent[k];
  parent[k] = parent[parent[k]];
  return find(parent, parent[k]);
}
int uni(vector<int>& parent, vector<vector<int>>& children, int a, int b,
        int last_v) {
  int pA = find(parent, a);
  int pB = find(parent, b);
  parent[pA] = last_v;
  parent[pB] = last_v;
  children[last_v] = vector<int>{pA, pB};
  return last_v + 1;
}
void printNode(vector<vector<int>> const& children, int node, int n) {
  if (node <= n) {
    cout << node << " ";
    return;
  }
  printNode(children, children[node][0], n);
  printNode(children, children[node][1], n);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> parent(2 * n + 1, -1);
  vector<vector<int>> children(2 * n + 1, vector<int>{});
  int last_v = n + 1;
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    cin >> a >> b;
    last_v = uni(parent, children, a, b, last_v);
  }
  printNode(children, last_v - 1, n);
  cout << endl;
}
