Coloring Geysers
Once, Lucy found a cave on one of the planets in the Link-Cut system. The cave consists of halls and passages; each passage connects two halls, and it is possible to reach any other hall from any hall through the passages.
In each hall, there is a coloring geyser. When the coloring geyser in hall number erupts, it colors all halls that are at a distance of no more than from hall in color number . The distance between two halls is defined as the minimum number of passages you need to travel through in order to move between them.
Lucy knows the structure of the cave, the colors of some halls, and that each geyser erupted exactly once. Based on this information, determine any possible order in which the eruptions could have occurred.
Input
The first line contains a single integer — the number of halls in the cave.
The second line contains integers — the distance coloring parameters for the geysers.
The third line contains integers , where is either the color number of the -th hall or , if the color of the -th hall is unknown.
The next lines describe the passages. The -th line contains two integers — the halls connected by the passage.
Output
In a single line, output integers , where is the number of the hall where the geyser which erupted -th is located. It is guaranteed that there is at least one order that corresponds to the input data.
Examples
Note
In the first example, here are the colors of halls after each eruption, assuming they happened in the order given in output:
Scoring
( points): ;
( points): ;
( points): ;
( points): ;
( points): no additional constraints.