#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn = 150005;
int fa[maxn], sz[maxn];
vector<int> v[maxn];
void init() {
  for (int i = 0; i <= n; i++) {
    fa[i] = i;
    sz[i] = 1;
    v[i].push_back(i);
  }
}
int getfa(int x) {
  if (fa[x] != x) fa[x] = getfa(fa[x]);
  return fa[x];
}
void merge(int x, int y) {
  int fax = getfa(x), fay = getfa(y);
  if (fax == fay) return;
  if (sz[fax] < sz[fay]) swap(fax, fay);
  fa[fay] = fax;
  sz[fax] += sz[fay];
  for (int i : v[fay]) v[fax].push_back(i);
}
int main() {
  scanf("%d", &n);
  init();
  for (int i = 1, a, b; i < n; i++) {
    scanf("%d%d", &a, &b);
    merge(a, b);
  }
  for (int i = 1; i <= n; i++)
    if (fa[i] == i) {
      for (int j : v[i]) printf("%d ", j);
      break;
    }
  return 0;
}
