#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> dept(150007);
int parent[150007];
int size[200007];
int nexti[200007];
void make_set(int v) {
  parent[v] = v;
  size[v] = 1;
  nexti[v] = v + 1;
}
int find_set(int v) {
  if (v == parent[v]) {
    return v;
  }
  return parent[v] = find_set(parent[v]);
}
void union_set_wo_size_rank(int a, int b) { parent[find_set(b)] = find_set(a); }
void union_set_by_size(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (size[a] < size[b]) {
      swap(a, b);
    }
    parent[b] = a;
  }
}
void union_set_skip(int i, int j) {
  if (i > j) {
    swap(i, j);
  }
  for (int l = i + 1; l <= j;) {
    union_set_by_size(l - 1, l);
    int temp = nexti[l];
    nexti[l] = max(nexti[l], j);
    l = temp;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  clock_t t1, t2;
  t1 = clock();
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    parent[i] = i;
    dept[i].push_back(i);
  }
  for (int i = 1; i <= (n - 1); i++) {
    int x, y;
    cin >> x >> y;
    x = find_set(x);
    y = find_set(y);
    if (x == y) {
      continue;
    }
    if (dept[x].size() > dept[y].size()) {
      swap(x, y);
    }
    for (auto it : dept[x]) {
      dept[y].push_back(it);
    }
    parent[x] = y;
    dept[x].clear();
  }
  int k = find_set(n);
  for (auto it : dept[k]) {
    cout << it << " ";
  }
  cout << "\n";
  return 0;
  t2 = clock();
  float diff = (float)t2 - (float)t1;
  float execution_time = diff / CLOCKS_PER_SEC;
}
