#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 152345;
const int MAX = 1123;
const int P = 1000000007;
const int INF = 112345;
const double EPS = 1e-6;
const double PI = 3.14159265358979;
struct Edge {
  int v, i;
  Edge(int _v, int _i) { v = _v, i = _i; }
  bool operator<(Edge e) const { return i > e.i; }
};
priority_queue<Edge, vector<Edge> > q;
vector<Edge> graph[MAX_N];
bool vis[MAX_N];
void showSubset(int src) {
  q.push(Edge(src, -1));
  while (!q.empty()) {
    Edge e = q.top();
    q.pop();
    printf("%d ", e.v);
    vis[e.v] = true;
    for (int i = 0; i < graph[e.v].size(); i++) {
      Edge e2 = graph[e.v][i];
      if (vis[e2.v]) {
        continue;
      }
      q.push(e2);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d %d", &u, &v);
    graph[u].push_back(Edge(v, i));
    graph[v].push_back(Edge(u, i));
  }
  memset(vis, false, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      showSubset(i);
    }
  }
  printf("\n");
  return 0;
}
