/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<ArrayList<Integer>> adj=new ArrayList<>();
		for(int i=0;i<=n;i++){
			adj.add(new ArrayList<>());
			
		}
		for(int i=0;i<n-1;i++){
			int x=sc.nextInt();
			int y=sc.nextInt();
			adj.get(x).add(y);
			adj.get(y).add(x);
		}
		int used[]=new int[n+1];
		int parent[]=new int [n+1];
		dfs(1,adj,used,parent);
	}
	public static void dfs(int node,ArrayList<ArrayList<Integer>> adj,int used[],int parent[]){
		System.out.println(node);
		used[node]=1;
		for(int x: adj.get(node)){
			if(used[x]==0){
				parent[x]=node;
				dfs(x,adj,used,parent);
			}
		}
	}
}