#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (T e : v) {
    os << e << ' ';
  }
  return os;
}
struct node {
  int parent, rank;
  list<int> reps;
};
constexpr int kMaxN = 150000 + 7;
node reps[kMaxN];
int parent(int x) {
  if (reps[x].parent == x) {
    return x;
  }
  return reps[x].parent = parent(reps[x].parent);
}
void fn_merge(int x, int y) {
  x = parent(x);
  y = parent(y);
  if (x == y) {
    assert(false);
    return;
  }
  if (reps[x].rank > reps[y].rank) {
    reps[y].parent = x;
    reps[x].reps.splice(reps[x].reps.end(), reps[y].reps);
  } else if (reps[x].rank < reps[y].rank) {
    reps[x].parent = y;
    reps[y].reps.splice(reps[y].reps.end(), reps[x].reps);
  } else {
    reps[y].parent = x;
    ++reps[x].rank;
    reps[x].reps.splice(reps[x].reps.end(), reps[y].reps);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0; i < kMaxN; ++i) {
    reps[i].parent = i;
    reps[i].rank = 0;
    reps[i].reps.emplace_back(i);
  }
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    fn_merge(x, y);
  }
  for (int x : reps[parent(1)].reps) {
    cout << x << ' ';
  }
  cout << '\n';
  return 0;
}
