#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353, MAXN = 300005, LOGN = 18, MAXM = 1005;
inline void S(int& n) {
  n = 0;
  int ch = getchar();
  int sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    n = (n << 3) + (n << 1) + ch - '0', ch = getchar();
  }
  n = n * sign;
}
const int SHIFT = 30, ETF = MOD - 1, LIM = (int)1e9;
const long long int INF = (long long int)1e18 + 1;
const double PI = (double)acos(-1), EPSILON = 1e-10;
vector<int> graph[MAXN];
int cnt = 0;
void dfs(int node, int par = 0) {
  if (graph[node].size() == 0) {
    printf("%d ", node);
  }
  for (int i = 0; i < graph[node].size(); i++) {
    int next = graph[node][i];
    if (next != par) {
      dfs(next, node);
    }
  }
}
int DSU[MAXN], Rank[MAXN], representee[MAXN];
int find(int x) { return x == DSU[x] ? x : DSU[x] = find(DSU[x]); }
int merge(int x, int y) {
  int px = find(x);
  int py = find(y);
  if (0) {
    cout << "px"
         << "=" << px << endl;
    cout << "py"
         << "=" << py << endl;
  }
  if (Rank[px] < Rank[py]) {
    swap(px, py);
  }
  cnt++;
  graph[cnt].push_back(representee[px]);
  graph[cnt].push_back(representee[py]);
  if (0) {
    cout << "cnt"
         << "=" << cnt << endl;
    cout << "representee[px]"
         << "=" << representee[px] << endl;
    cout << "representee[py]"
         << "=" << representee[py] << endl;
  }
  DSU[py] = px;
  Rank[px] += Rank[py];
  representee[px] = cnt;
  return cnt;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    DSU[i] = i;
    Rank[i] = 1;
    representee[i] = i;
  }
  cnt = n;
  int start = -1;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    S(u);
    S(v);
    start = merge(u, v);
    if (0) {
      cout << "start"
           << "=" << start << endl;
    }
  }
  dfs(start);
  printf("\n");
  return 0;
}
