using System.Collections.Generic;
public static void Main()
int n = int.Parse(Console.ReadLine());
int[,] edges = new int[n + 1, 4];
for(int i = 0; i < n - 1; i++)
string[] input = Console.ReadLine().Split(' ');
int cityFrom = int.Parse(input[0]);
int cityTo = int.Parse(input[1]);
if(edges[cityFrom, 0] == 0)
edges[cityFrom, 0] = cityTo;
if(cityTo < edges[cityFrom, 0])
int temp = edges[cityFrom, 0];
edges[cityFrom, 0] = cityTo;
edges[cityFrom, 1] = temp;
edges[cityFrom, 1] = cityTo;
edges[cityTo, 2] = cityFrom;
string[] str = Console.ReadLine().Split(' ');
int[] leaves = new int[k];
int[][] leafFullRoutes = new int[k][];
for(int i = 0; i < k; i++)
int leaf = int.Parse(str[i]);
var leafFullRoute = new List<int>();
leafFullRoute.Add(current);
int parent = edges[current, 2];
leafFullRoutes[i] = leafFullRoute.ToArray();
var route = new List<int>();
int[] firstRoute = leafFullRoutes[0];
length = firstRoute.Length;
for(int j = length - 1; j > 0; j--)
int current = firstRoute[j];
for(int i = 0; i < k - 1; i++)
length = leafFullRoutes[i].Length;
int nextHeadIndex = leafFullRoutes[i + 1].Length - 1;
for(int j = 0; j < length - 1; j++)
current = leafFullRoutes[i][j];
index = Array.IndexOf(leafFullRoutes[i + 1], current);
int nextLeaf = leafFullRoutes[i + 1][0];
while(current != nextLeaf)
current = leafFullRoutes[i + 1][index];
int[] lastRoute = leafFullRoutes[leafFullRoutes.Length - 1];
length = lastRoute.Length;
for(int j = 0; j < length; j++)
int current = lastRoute[j];
foreach(var vertex in route)
Console.Write(vertex + " ");