#P1394. 山上的国度
山上的国度
Description
A mysterious small country lies atop the verdant mountains in the south. Only at dusk, when the dazzling afterglow of the setting sun pierces the thin mist, can the destined few see the beautiful villages on the hill.
Legend says there are hub pipelines in this ancient country. Each aged pipeline connects two villages and has carried water for the villagers for centuries.
Among the villages there is exactly one reservoir, which supplies water from its village to the others through these hub pipelines. Everyone knows that water flows downhill, and all villages can receive supply from the reservoir.
Huang Xiaoming is one of the destined few, and he is also quite obsessive. He is eager to know in which village the reservoir should be located. Can you help resolve his doubt?
Input Format
The first line contains ().
The second line contains positive integers; the -th number is the elevation of the -th village. Then follow lines, each containing two integers indicating that there is a pipeline between those two villages. (No flow is possible between villages of the same elevation.)
Output Format
If such a village exists, output two lines: the first line is Oui, j'ai trouve la solution., and the second line is the index of the village.
Otherwise, output Non.
4 2
1 2 3 4
1 2
3 4
Non
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号