#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
const int INF = 1 << 29;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int& n, int b) { n |= two(b); }
inline void unset_bit(int& n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
void func(long long n, vector<int> v[], long long sv) {
  cout << sv << " ";
  for (long long i = 0; i < v[sv].size(); i++) {
    func(n, v, v[sv][i]);
  }
}
int find(int v, int p[]) {
  if (v == p[v]) return v;
  return p[v] = find(p[v], p);
}
int main() {
  long long n;
  cin >> n;
  int p[n + 1];
  for (int i = 0; i < (n + 1); i++) {
    p[i] = i;
  }
  vector<int> edge[n + 1];
  int a, b;
  for (long long i = 1; i < n; i++) {
    cin >> a >> b;
    a = find(a, p);
    b = find(b, p);
    p[b] = a;
    edge[a].push_back(b);
  }
  int sv = find(1, p);
  func(n, edge, sv);
  return 0;
}
