#include <bits/stdc++.h>
using namespace std;
long long const mod = 1000000007;
long long const md = 998244353;
long long mypowr(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long mypow(long long a, long long b) {
  long long res = 1;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    a = a * a;
  }
  return res;
}
ifstream in("txt.in");
ofstream out("txt.out");
vector<int> v[150005];
vector<pair<int, int>> f[150005];
map<pair<int, int>, int> q;
priority_queue<int, vector<int>, greater<int>> t;
bool vis[150005];
int main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(15);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long nr = 0;
  for (int i = 1; i < n; ++i) {
    long long x, y;
    cin >> x >> y;
    if (i == 1) {
      vis[x] = 1;
      nr = x;
    }
    v[x].push_back(y);
    v[y].push_back(x);
    f[i].push_back({x, y});
    q[{x, y}] = i;
    q[{y, x}] = i;
  }
  cout << nr << " ";
  for (auto u : v[nr]) {
    t.push(q[{nr, u}]);
  }
  while (!t.empty()) {
    int u = t.top();
    t.pop();
    int x = f[u][0].first;
    int y = f[u][0].second;
    if (!vis[x]) {
      for (auto u : v[x]) {
        t.push(q[{x, u}]);
      }
      vis[x] = 1;
      cout << x << " ";
    }
    if (!vis[y]) {
      for (auto u : v[y]) {
        t.push(q[{y, u}]);
      }
      vis[y] = 1;
      cout << y << " ";
    }
  }
  return 0;
}
