#include <bits/stdc++.h>
using namespace std;
inline long long Readin() {
  long long K = 0, F = 1;
  char C = ' ';
  while (C < '0' or C > '9') F = C == '-' ? -1 : 1, C = getchar();
  while (C <= '9' and C >= '0')
    K = (K << 1) + (K << 3) + C - '0', C = getchar();
  return F * K;
}
const int MaxN = 150000 + 10;
int N;
int Find[MaxN], Size[MaxN];
int F(int Nod) { return Nod == Find[Nod] ? Nod : (Find[Nod] = F(Find[Nod])); }
vector<int> Ans[MaxN];
int main() {
  N = Readin();
  for (register int i = 0; ++i <= N;) {
    Find[i] = i;
    Size[i] = 1;
    Ans[i].push_back(i);
  }
  for (register int i = 1; ++i <= N;) {
    register int A = Readin(), B = Readin();
    A = F(A);
    B = F(B);
    if (Size[A] > Size[B]) swap(A, B);
    for (register int i = 0, I = Ans[A].size(); i < I; ++i)
      Ans[B].push_back(Ans[A][i]);
    Size[B] += Size[A];
    Find[A] = B;
  }
  register int Top = F(1);
  for (register int i = 0; i < N; ++i) printf("%d ", Ans[Top][i]);
  return not printf("\n");
}
