#include <bits/stdc++.h>
using namespace std;
long findRoot(long i, long p[]) {
  while (i != p[i]) {
    p[i] = p[p[i]];
    i = p[i];
  }
  return i;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long n, a, b;
  cin >> n;
  queue<long> q[n + 1];
  long p[n + 1], size[n + 1];
  for (int i = 1; i <= n; ++i) {
    q[i].push(i);
    p[i] = i;
    size[i] = 1;
  }
  for (long i = 0; i < n - 1; ++i) {
    cin >> a >> b;
    a = findRoot(a, p);
    b = findRoot(b, p);
    if (size[a] >= size[b]) {
      while (!q[b].empty()) {
        q[a].push(q[b].front());
        q[b].pop();
      }
      p[b] = a;
      size[a] += size[b];
    } else {
      while (!q[a].empty()) {
        q[b].push(q[a].front());
        q[a].pop();
      }
      p[a] = b;
      size[b] += size[a];
    }
  }
  for (long i = 1; i <= n; ++i)
    if (!q[i].empty()) {
      while (!q[i].empty()) {
        cout << q[i].front() << " ";
        q[i].pop();
      }
      break;
    }
  return 0;
}
