#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 2;
pair<long long, long long> a[N];
int cur[N], ans[N], t[N];
int gid;
void go(int x, int low, int high) {
  pair<long long, long long> fr = a[x];
  if (low == high)
    ans[low] = fr.first;
  else {
    go(fr.first, low, low + t[fr.first] - 1);
    go(fr.second, low + t[fr.first], high);
  }
}
int find(int x) {
  if (cur[x] != cur[cur[x]]) return cur[x] = find(cur[x]);
  return cur[x];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  for (int(i) = (1); (i) < (n + 1); (i)++) a[i] = make_pair(i, -1);
  for (int(i) = (1); (i) < (N); (i)++) {
    cur[i] = i;
    t[i] = 1;
  }
  gid = n + 1;
  for (int(i) = (0); (i) < (n - 1); (i)++) {
    int aa, b;
    cin >> aa >> b;
    int x = find(aa), y = find(b);
    a[gid] = make_pair(x, y);
    t[gid] = t[x] + t[y];
    cur[x] = gid;
    cur[y] = gid;
    gid++;
  }
  gid--;
  go(gid, 0, n - 1);
  for (int(i) = (0); (i) < (n); (i)++) {
    cout << ans[i];
    if (i != n - 1) cout << " ";
  }
  cout << endl;
  return 0;
}
