#include <bits/stdc++.h>
using namespace std;
long long count(long long n) {
  long long k = n, s = 0;
  while (k > 0) {
    s += k % 10;
    k /= 10;
  }
  return s;
}
long long div(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return n / i;
    }
  }
  return 0;
}
long long d, x, y;
void extendedEuclid(long long A, long long B) {
  if (B == 0) {
    d = A;
    x = 1;
    y = 0;
  } else {
    extendedEuclid(B, A % B);
    int temp = x;
    x = y;
    y = temp - (A / B) * y;
  }
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long isPrime(long long n) {
  if (n == 0 || n == 1) return 0;
  if (n % 2 == 0) return 2;
  if (n % 3 == 0) return 3;
  for (long long i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0) return i;
    if (n % (i + 2) == 0) return i + 2;
  }
  return n;
}
map<long long, long long> vis;
vector<long long> a(100050);
vector<vector<long long> > adj(150005);
long long dfs(long long n) {
  long long i, q = a[n];
  stack<long long> s;
  s.push(n);
  vector<long long> temp;
  long long c = 1;
  vector<long long> ind;
  while (s.size() > 0) {
    long long x = s.top();
    s.pop();
    for (i = 0; i < adj[x].size(); i++) {
      if (vis[adj[x][i]] == 0) {
        s.push(adj[x][i]);
        temp.push_back(a[adj[x][i]]);
        ind.push_back(adj[x][i]);
        vis[adj[x][i]] = 1;
      }
    }
  }
  sort(temp.begin(), temp.end());
  sort(ind.begin(), ind.end());
  for (i = 0; i < ind.size(); i++) a[ind[i]] = temp[i];
}
vector<long long> connect(150005), si(150005);
vector<vector<long long> > tree(150005);
void ini(long long n) {
  for (long long i = 1; i <= n; i++) {
    si[i] = 1;
    tree[i].push_back(i);
    connect[i] = i;
  }
}
long long root(long long n) {
  while (n != connect[n]) {
    connect[n] = connect[connect[n]];
    n = connect[n];
  }
  return n;
}
void uni(long long m, long long n) {
  m = root(m);
  n = root(n);
  if (si[m] >= si[n]) {
    for (long long i = 0; i < tree[n].size(); i++) {
      tree[m].push_back(tree[n][i]);
    }
    si[m] += si[n];
    connect[n] = connect[m];
  } else {
    for (long long i = 0; i < tree[m].size(); i++) {
      tree[n].push_back(tree[m][i]);
    }
    si[n] += si[m];
    connect[m] = connect[n];
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  long long n, i;
  cin >> n;
  ini(n);
  for (i = 0; i < n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    uni(x, y);
  }
  long long ans = root(1);
  for (i = 0; i < tree[ans].size(); i++) {
    cout << tree[ans][i] << " ";
  }
}
